aboutsummaryrefslogtreecommitdiffstatshomepage
Commit message (Collapse)AuthorAgeLines
* Restructure AUTHORS section in the manualWolfgang Müller2024-11-06-3/+3
| | | | later(1) has become a joint effort, so make that clear in the manual.
* Allow manually deleting watch_later entriesWolfgang Müller2024-11-06-2/+25
| | | | | | | This commit introduces the "del" command which allows the user to delete watch_later entries manually. Make sure to silently ignore entries that were not found - we'll print the entire list of entries subsequently anyway.
* Allow manually creating watch_later entriesWolfgang Müller2024-11-06-3/+38
| | | | | | | | This commit introduces the "add" command which allows the user to create watch_later entries manually. Make sure to silently ignore entries that already exist - we'll print the entire list of entries subsequently anyway. Also, make explicitly specifying "add" optional if there's any remaining arguments in argv.
* Use getopt-based parser for command-line argumentsWolfgang Müller2024-11-06-22/+87
| | | | | | | | | | | | | | Upcoming commits will want to make use of bespoke argument handling alongside subcommands and using Python's argparse proved unable to easily handle that kind of complexity. Therefore switch to the more basic getopt-based parser with which we can implement our own logic. Without argparse we're no longer bound to having an autogenerated help listing, so stop mentioning that in the manual. Instead have later(1) output a concise usage listing when given an unknown argument. Since we'll be adding more commands to later(1) in the future, also specify an explicit "list" command.
* Avoid shadowing builtinsWolfgang Müller2024-11-06-2/+6
| | | | | | | | | | This will hopefully avoid nasty surprises in the future. It's easy to check since there is already a ruff linter [1] for it which this commit also enables. Make sure not to complain about exit() [2] since that is only for interactive use and shouldn't be called in programs anyway. [1] https://docs.astral.sh/ruff/rules/builtin-attribute-shadowing/ [2] https://docs.python.org/3.12/library/constants.html#exit
* Introduce small helper function for sys.exitWolfgang Müller2024-10-26-3/+7
| | | | | This saves us from specifying the program name every single time we want the program to exit with an error message.
* Don't rely on WatchLaterEntry formatting to track cache livenessJuhani Krekelä2024-10-26-3/+5
| | | | | | | Currently an entry in the cache is marked as live implicitly whenever it is requested, which only happens when formatting a WatchLaterEntry. Instead, explicitly mark the entry as live at the same time as the WatchLaterEntry object is created in entries().
* Pass title_map explicitly when formatting WatchLaterEntryJuhani Krekelä2024-10-26-2/+2
| | | | | | WatchLaterEntry's __str__ method implicitly depends on the title_map variable existing in the global scope. This makes the dependency on the title_map explicit.
* Persist only cache entries that are in useJuhani Krekelä2024-09-22-1/+8
|
* Handle a missing yt_dlp moduleWolfgang Müller2024-09-22-3/+6
|
* Mention write-filename-in-watch-later-config in the manualWolfgang Müller2024-09-22-1/+6
|
* lint: open() defaults to read-only, so use thatWolfgang Müller2024-09-21-2/+2
|
* Add ruff.toml with lint settingsWolfgang Müller2024-09-21-0/+14
| | | | | This should be a reasonable selection of linters. Also make sure that ruff picks up 'later' by default, since it is missing the .py suffix.
* Simplify the .get() method on TitleMap.Juhani Krekelä2024-09-19-4/+2
|
* Fix typo in later.1Wolfgang Müller2024-09-19-1/+1
|
* Use __str__ instead of __repr__ for pretty-printing WatchLaterEntryWolfgang Müller2024-09-19-1/+1
| | | | | | | __repr__ is supposed to compute the "official" string representation of an object [1] and not a pretty-printed version, so use __str__ instead. [1] https://docs.python.org/3.12/reference/datamodel.html#object.__repr__
* Improve error messagesWolfgang Müller2024-09-19-2/+2
|
* Handle OSErrors when writing out the title cacheWolfgang Müller2024-09-19-2/+5
| | | | We handle these when reading the file, so we might as well do it here.
* Move functionality into classesWolfgang Müller2024-09-19-57/+94
| | | | | | | | | | | | This should disentangle the logic a bit and make the entire code base easier to work with. The watch_later entries are now kept in a WatchLaterEntry dataclass which supports pretty-printing with __repr__. Fetching of titles is now done through a dedicated TitleMap class which imports yt_dlp as late as possible, speeding up printing of entries that don't need to be updated and avoiding the import entirely if everything can be fetched from cache. Otherwise there should not be any functional change.
* Have entries() continue early if an entry is not a fileWolfgang Müller2024-09-19-10/+12
| | | | | This makes this already quite deeply nested function a bit easier to read.
* Parse entries when collectingWolfgang Müller2024-09-19-12/+13
| | | | | | | The piece of logic that parses the name of the watch_later entry and makes sure that no redirect entries are processed can easily be moved into the entries() generator. This way we don't even generate items that we end up skipping anyway.
* Move YTDLPLogger to beginning of fileWolfgang Müller2024-09-19-11/+11
|
* Use function to determine XDG directoriesWolfgang Müller2024-09-19-7/+9
| | | | We do the same thing here twice, so this seems worth it.
* lint: Remove newline from importsWolfgang Müller2024-09-19-1/+0
|
* Use os.makedirs instead of os.mkdirWolfgang Müller2024-09-19-4/+2
| | | | | This will make sure that the whole directory structure will be created if missing and saves us a try/except block with exist_ok.
* Add .editorconfigWolfgang Müller2024-09-14-0/+12
|
* Show video titles using yt-dlpJuhani Krekelä2024-09-12-6/+104
| | | | | | | | | | Different video URLs can be easy to confuse in the output of later(1). Look up titles for them in $XDG_CACHE_HOME/later/title.json and add an option, --update-titles, to populate the file automatically using yt-dlp. The title is prefixed with a hash sign (#) in order to better separate it visually from the URLs, as well as to allow easier copypasting of output onto an mpv command line.
* Change xdg_config_home to xdg_state_homeJuhani Krekelä2024-09-11-3/+3
|
* Initial commitWolfgang Müller2024-09-10-0/+92