Commit graph

238 commits

Author SHA1 Message Date
5841279f9e Sync common.js with Etiquette. 2020-11-08 19:32:04 -08:00
be7c5982e9 Don't use a default refresh rate. User must provide --refresh_rate. 2020-11-03 00:04:32 -08:00
4b1fde386d Add some docstrings to the request code. 2020-11-03 00:03:59 -08:00
e09153c5e3 Alert response if download/ignore/pending action fails. 2020-10-29 16:14:58 -07:00
42417ed008 Sync common.js with Etiquette. 2020-10-23 07:44:18 -07:00
c5c67b9c69 Let select_all, deselect_all ignore hidden cards.
So that ctrl+a after filtering only selects the filter results.
2020-10-11 18:43:47 -07:00
67a3472aad Avoid creating emptystring promptclass. 2020-10-04 16:53:27 -07:00
14ab3f3b06 Reorganize a bunch of functions and other indulgences. 2020-10-02 19:46:36 -07:00
ed3942b943 Let response status be 0 even if request didn't complete.
Since meta.status would be undefined for an incomplete request,
I would have to check response.completed && response.meta.status,
which is too much burden. Let's set the status immediately, and
if a callback wants to do further diving we'll use completed then.
2020-10-02 19:43:25 -07:00
94e3bcd21d Set tabbed_container data-active-tab-id on tab change. 2020-10-02 13:17:38 -07:00
0f9fbfa6e8 Add synchronized hotkeys.js from Etiquette; add ctrl+a, ctrl+d. 2020-10-02 13:17:08 -07:00
d1b42b71cb Enforce keyword-only args, alphabetize args. 2020-09-30 15:17:27 -07:00
bb72c40c53 Add option --localhost_only. 2020-09-30 15:15:30 -07:00
038ce9cffb Rename flask launchers -> _dev, _prod.
I want to reduce some complexity around here, part of which is that
launch imported entrypoint imported backend, all to do some proxy
wrapping which isn't necessary for the dev case anyway. Less
layers of wrapping and importing is good. Plus I think this naming
is more clear.
Additionally, I realized that the entrypoint aka prod launcher was
never updated to init the ycdldb as that was only done by the argparse
launcher. Now it's hardcoded and I'll consider adding a config file.
2020-09-30 15:03:29 -07:00
f77809e793 Add top docstring and log format like Etiquette. 2020-09-30 14:47:05 -07:00
fb1d5d3e6e Add select_all. 2020-09-29 10:55:04 -07:00
ede7eab80b Replace this loop with a nice map. 2020-09-29 10:54:58 -07:00
16dc6066df Leverage live HTMLCollection for selections instead of separate array. 2020-09-29 10:54:31 -07:00
898be91538 Spread video embed string over multiple lines. 2020-09-29 01:17:05 -07:00
572612a282 Replace variable swap with a one-liner. 2020-09-29 01:16:35 -07:00
e584e05f5e Move color definitions from common.css to ycdl.css. 2020-09-25 16:25:39 -07:00
4f6080859a Synchronize Etiquette and YCDL. 2020-09-22 02:59:17 -07:00
69c1dd92e9 Synchronize --wide, --narrow with Etiquette. 2020-09-19 10:42:31 -07:00
34aafedf46 Synchronize with Etiquette. 2020-09-18 16:35:02 -07:00
741cddc2e4 Add set_queuefile_extension method, endpoint, and ui. 2020-09-16 10:23:38 -07:00
223d3d01fb Rename automark_hook -> _form; use more const. 2020-09-16 10:22:33 -07:00
76b1504353 Synchronize with Etiquette. 2020-09-15 15:04:50 -07:00
ec19301bcc Rewrite entry_with_history hook and use keydown instead of keyup. 2020-09-12 10:14:52 -07:00
f4455f5a82 Add return to onchange. 2020-09-12 10:14:06 -07:00
cd5106df59 Rename color_3d_shadow -> color_shadow. 2020-09-09 15:58:04 -07:00
0116d80740 Mark the current state and orderby links in bold. 2020-09-05 17:49:04 -07:00
d0e803aa66 Supply the orderby argument to channel.html template. 2020-09-05 17:48:29 -07:00
d140a580c3 Add .bold class. 2020-09-05 17:47:53 -07:00
37df5a6443 Remove spacer <p>s and embrace the grid-gap. 2020-09-05 09:31:37 -07:00
339fa6649f Remove useless one-tab container for sub box by better if placement. 2020-09-05 09:31:13 -07:00
e5910c55f2 Rename database column download to state. 2020-09-04 15:55:48 -07:00
0ae041f001 Add whitelist/blacklist functionality to merge_params. 2020-09-04 15:10:58 -07:00
7d3a9fe03e Add explanation of data-prompt-class et al.
I think I left these blank because I felt they should be obvious.
But I'd rather have it explicit.
2020-09-04 14:50:30 -07:00
fc4aebc4a4 Fix double "return return". 2020-09-04 14:48:50 -07:00
98fae96a8a Add spinner.BAIL for cancelling spinner without launching callback. 2020-09-04 11:24:08 -07:00
0518765f33 Add css/js class entry_with_history to automate adding the hook. 2020-09-04 11:18:41 -07:00
26704c238e Fix catch ytapi.ChannelNotFound and return json 404. 2020-09-04 10:48:08 -07:00
4af4985ac5 Add return to all onclicks, and ; to other javascript hooks. 2020-09-04 10:37:49 -07:00
afcea49135 Fine-tune use of let/const in spinner.js. 2020-09-03 15:57:07 -07:00
03c366fff8 Replace var with let/const. 2020-09-03 15:44:58 -07:00
2a5983b124 Change #content_body width from 95% to 98%. 2020-09-03 12:06:35 -07:00
a524249ab4 Improve color of tab buttons active/inactive/hover. 2020-09-03 12:03:53 -07:00
3a455d377b Rewrite channel.html as tabbed container, separate videos/settings. 2020-09-03 11:54:51 -07:00
f103447807 Add css/js class tabbed_container. 2020-09-03 11:54:00 -07:00
b8c25f217d Synchronize Etiquette common.css and YCDL common.css. 2020-09-03 11:52:51 -07:00
d4cad47b78 Add docstring to init_enable_on_pageload. 2020-09-03 11:51:30 -07:00
8dd7fb987d Add placeholder text to new_channel_textbox. 2020-09-03 11:44:49 -07:00
c37cd60d4d Compress responses with gzip. 2020-08-28 16:43:02 -07:00
65e0d58576 Disable filter textbox until pageload.
For channels with many thousands of videos, it can be a while
before the DOM is fully parsed and ready to go. It is annoying
to type in the box and find that it doesn't work yet, since the
script tag comes after body.
Why not move the script above body? Because I don't want to,
and because you'd be filtering from an incomplete list of
videos anyway.
2020-08-28 16:21:42 -07:00
25e9975926 Add css/js class enable_on_pageload. 2020-08-28 16:18:51 -07:00
25a611e39e Add 200ms timeout before filtering while you type your query. 2020-08-27 17:11:52 -07:00
7b197c867b Speed up filtering by hiding #video_cards first.
On large channels, filter_video_cards is painfully slow because of all
the forced reflows. I'm currently trying to find a better solution.
In the meantime, hiding the containing div does prevent those reflows
until the end, but itself is also quite slow.
2020-08-27 16:53:51 -07:00
412d324352 Remove unused parameter event. 2020-08-20 15:09:37 -07:00
e083223cfc Add button_with_spinner class to add channel button. 2020-08-20 15:09:23 -07:00
17cd98fa50 Let image thumbnails lazy load. 2020-08-15 22:28:53 -07:00
de5aba4895 Remove unnecessary spacer when channel is none. 2020-08-15 22:28:27 -07:00
5610d756c2 Fix video_cards variable name being used twice, breaking filter. 2020-08-15 22:27:47 -07:00
6bd4997f3f Simplify logging.getLogger because they are hierarchical. 2020-08-12 11:25:59 -07:00
3f3eda58b1 Move logging basicconfig effort to frontmost application layer. 2020-08-12 11:17:10 -07:00
ee89582a1b Return 404 when channel could not be added and still does not exist. 2020-08-12 10:28:06 -07:00
be45de55f5 Use generator comprehension instead of list comprehension for ?q. 2020-08-11 21:50:38 -07:00
e90254cfeb Copy some common css from Etiquette. 2020-08-10 20:55:23 -07:00
b660d700b9 Add endpoint and gui button for deleting channels. 2020-08-10 18:30:56 -07:00
e42e4cac55 Add #toolbox_left and #toolbox_right where I can put more buttons. 2020-08-10 18:29:50 -07:00
213278edcc Capitalize state filter links, remove commas from sorter links.
To make these two rows look similar. Rather than lowercasing the
sorters, let's capitalize the state filters. And rather than adding
a ','.join to the state filters, let's just remove commas from the
sorters. Good enough.
2020-08-09 17:54:38 -07:00
c13f02006b Let button_with_confirm inherit original CSS when not specified. 2020-08-08 18:59:17 -07:00
1eafdf5e5b Add skewer-case aliases for snake_case arguments. 2020-08-08 18:58:39 -07:00
ff0d01fdda Add more to docstring about spinner delay attribute. 2020-07-10 16:34:32 -07:00
4911cee910 Use generators instead of lists for loading / searching videos.
Previously, creating the list meant that all database rows would be
loaded and objected even if you had a limit in place on your page
query, which was a huge waste.
2020-07-01 17:54:36 -07:00
bacdad07a6 Add docstring to bind_box_to_button, and some small linting. 2020-06-30 20:32:29 -07:00
6a41b18ba7 Dedent by using early returns. 2020-06-28 17:07:12 -07:00
3044907264 Use dot notation instead of subscript on response. 2020-06-28 16:57:32 -07:00
1e4f4441bb Use dot notation instead of subscript. 2020-06-28 16:55:37 -07:00
fcbb128f47 Add attribute "completed" to response object. 2020-06-28 16:47:54 -07:00
27219d74c4 Add spinner when setting automark. 2020-06-26 20:59:55 -07:00
f1e80dac94 Add spinners to channel refresh buttons. 2020-06-17 14:15:50 -07:00
235bc2501d Add spinner.js, synced with Etiquette. 2020-06-17 14:15:13 -07:00
dd59fd2c36 Import common.js before api.js. 2020-06-17 14:13:33 -07:00
e420d92f6c Add more docstring to button_with_confirm data-onclick parameter. 2020-06-17 14:09:02 -07:00
d2d8a69d39 Synchronize Etiquette common.js and YCDL common.js. 2020-06-17 13:38:01 -07:00
ff1b043279 Arrange the state filters horizontally instead of vertically.
The "New videos are" dropdown and the sorting options are both
horizontal, so this one being vertical stuck out badly visually.
This is a little better.
2020-06-10 23:09:17 -07:00
9c629d53b1 Remove some useless functions from common.js. 2020-06-04 19:04:51 -07:00
66f499c232 Move functions mark_state, start_download to api.js. 2020-06-03 13:01:53 -07:00
d996101152 Move function set_automark to api.js. 2020-06-03 13:01:28 -07:00
ba1f17da75 Move function add_channel to api.js. 2020-06-03 13:00:44 -07:00
1f2c43278a Move function refresh_all_channels to api.js. 2020-06-03 13:00:16 -07:00
ab1a2364be Move function refresh_channel to api.js. 2020-06-03 12:59:29 -07:00
b76be18b6c Add CHANNEL_ID variable to js via jinja. 2020-06-03 12:58:33 -07:00
415acdf7d1 Add api.js. 2020-06-03 12:54:20 -07:00
d0a0a87b43 Add function common.refresh. 2020-06-03 12:28:09 -07:00
113a92fb5b Move function html_to_element to common.js. 2020-06-03 12:26:25 -07:00
2ba9eb8df2 Add docstring for init_atag_merge_params. 2020-06-03 12:21:23 -07:00
bd27a910e1 Fix bugs introduced by new http response["data"] format. 2020-05-21 22:20:50 -07:00
3e27e6e2e8 Add separate API endpoint for add_channel, apply to web ui.
Previously, the "add channel" box was just calling refresh, which
implicitly adds the channel. This adds a separate endpoint for
add_channel, and as a bonus the web ui will navigate you to the
channel after it has been loaded.
2020-05-21 22:16:02 -07:00
480eeb9ac3 Update common.js request, get, post functions like Etiquette. 2020-05-21 20:29:43 -07:00
21af1576c2 Move endpoints into separate files like Etiquette. 2020-05-21 20:04:02 -07:00
13a72ec7fc Move CSS and JS into separate folders under static. 2020-05-21 19:43:45 -07:00
57d87560a4 Add interface for setting automark state. 2020-05-21 17:28:34 -07:00
0c5823cbeb Indicate automark state on /channels listing. 2020-05-21 17:26:12 -07:00
af494e2684 Rename CSS class channel_card_downloaded -> channel_card_no_pending. 2020-05-21 17:22:07 -07:00
2f5ec40b89 Big: Object-oriented channels & videos, match Etiquette structure.
- Channels and videos are now objects instead of just dictionaries.
- Copied Etiquette's use of cachemanager mixin to cache those objects.
- Copied Etiquette's use of sql_ methods.
- Copied Etiquette's use of namespaced javascript.
- Copied Etiquette's use of config file.
- Redid video_card css to use grid, better on mobile.
- Improved usage of URL parameters with class=merge_class.
- Wrote some actual content on readme.
2020-04-05 18:59:16 -07:00
4689609c97 Add links for sort by date, duration, views, random. 2020-04-03 14:24:48 -07:00
718399806a Add channel_name to videos before returning them, show on listings.
Previously, when viewing a /videos listing, there was a link
called (Chan) to bring you to the channel page, but since videos
only carried author_id and not author_name it was always kind of
ugly. This will inject that attribute on the way out.
I know, this would be more properly written as an SQL join in the
first place, but my row-dict conversion isn't set up for that and
I'm planning on converting this all to object-based returns instead
of dicts soon.
2020-04-03 08:49:35 -07:00
1b456bf900 Let embedded video fit width of the video card instead of hard px.
This makes the page much easier to use on mobile. On desktop I think
the new size may be a little overwhelming but I'll try getting used
to it, and anyway I think it simply makes more sense than the
arbitrary size from earlier.
2020-04-03 08:43:47 -07:00
275db1e608 Fix typo googleapicliet -> googleapiclient. 2020-03-28 17:07:18 -07:00
4effa64694 Move endpoints to new endpoints.py. 2020-03-28 17:05:43 -07:00
1b2778ca7a Rename ycdl_flask.py to common.py. 2020-03-28 16:56:06 -07:00
790fbd7b9a Remove this ifmain. 2020-03-28 16:53:39 -07:00
d407326392 Move make_json_response into new jsonify.py. 2020-03-28 16:51:40 -07:00
c7ef2dd41b Rearrange these imports. 2020-03-28 16:49:33 -07:00
428ada8c83 Rename inner ycdl_flask folder to backend.
Following the same thing as I did with etiquette.
2020-03-28 16:47:37 -07:00
201ae70ba0 Use argparse to expose refresher thread controls. 2020-03-28 16:44:47 -07:00
9fe7057021 Move refresher thread launcher into a function. 2020-03-28 16:42:54 -07:00
08ae8a9394 Update reference to ycdldb. 2020-03-17 20:52:50 -07:00
9b227c6e5f Add link to random pending videos on homepage. 2020-03-13 14:38:27 -07:00
b5f892d595 Add ?orderby url parameter. 2020-03-11 18:02:09 -07:00
672abf9d86 Hold Shift to not deselect videos after setting a state. 2020-03-11 14:30:56 -07:00
26328865e1 Pass list of all states to page for autogeneration of elements. 2020-03-11 14:30:12 -07:00
b48c2fc37c Rename ycdl.py -> ycdldb.py; add exceptions.py. 2020-03-11 14:27:27 -07:00
3d3da805b6 Stop selecting text when shift-clicking to select videos. 2020-03-11 13:01:55 -07:00
6691c49481 Add parameter skip_failures to refresh_all_channels. 2020-01-19 10:53:49 -08:00
29d819fe97 Add a refresher thread to keep your sub box up to date. 2020-01-06 22:07:43 -08:00
78ce6a6f41 Add views column and some other database changes.
And various other changes which have been sitting here for too long.
2020-01-06 22:07:25 -08:00
4706a0a6a7 Add 'sub box' link to 100 latest videos from all channels. 2020-01-06 22:01:58 -08:00
1c69a2aa59 Personal changes. 2020-01-06 22:01:23 -08:00
a29a637bcb Put the refresh buttons inside spans. 2020-01-06 21:56:45 -08:00
2826e8972f Add link directly to channel's pending page. 2020-01-06 21:56:22 -08:00
12c2b882f2 Add the meta viewport property. 2020-01-06 21:55:01 -08:00
9160d25293 Fix seconds_to_hms bug!
Embarrassing. If M was zero then you got HH:SS.
2020-01-06 20:25:58 -08:00
6b24b7416c Modifying search box reapplies download filter, removes cards.
Example: If you are using the /pending filter, and use the search
box to find some videos and ignore them, then those videos will
be removed from the DOM. That way they aren't still there when you
clear the text box to see the other pending videos.
2019-01-25 15:54:31 -08:00
c667ebd872 Batch requests & filterbox & update metadata
- Download / Ignore on multiple videos is batched into a single
  request, like it should have been all along.
- Text box at the top of the page lets you search for terms live
  instead of loading various ?q urls.
- Doing a force refresh will actually update the metadata of old
  videos instead of skipping them.
2019-01-23 21:22:09 -08:00
f1f12423b1 Changes
- Add thumbnails to the card (dynamically loaded)
- Add button for embedding the video
- Store video duration in db (use update script)
- Separate links for filter views with and without query.
2018-12-17 19:17:53 -08:00
ba1961349c It's been a while 2017-10-08 21:39:07 -07:00