-
Notifications
You must be signed in to change notification settings - Fork 11
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Implementation of series feature #61
Conversation
Sorry, it took me a while over the Easter weekend. Good direction already :) |
For the next steps: Downsides:
Is that what we want to have? |
I would guess running this match during import with a precompiled regex is not very slow. For example, parsing the date is really slow, but the script does it anyway. Given we make the regex configurable, it would not work anyway. We could try to use a python regex call as a custom sqlite function like this, and apply it on the SELECT. Not sure how slow it is, it is worth a try. Not? |
Looking at the sqlite documentation, it seems that you can only define one What we probably need is to extract the season/episode information using "function callbacks", something like: SELECT ... , GET_SEASON(title) as season, GET_EPISODE(title) as episode ... WHERE And then we can filter this information using the normal SQL features. Or did I miss something? Thinking about the filtering for season/episode more: |
I would also probably not filter for it. The only reason i see is if you wait for a new season while the old one is still aired over and over again, and you want a filter to only get shows with seasons greater than that. For the regex, i think you are right. The function callbacks would be a good workaround, but we probably do not need them. |
I looked for more season/episode patterns in the title file from the raw Examples
Other observations
ConclusionI guess we can cover most of these cases with a couple of regular expressions quite well, but not all of them. Maybe we should offer a combination of pre-configured patterns and allowing the user to add more for corner cases? Maybe also allow to manually override the season number? This would also mean that we should show season and episode in the Relatively reliable patterns:
Sorry for the long post, however the reality of heuristics is messy 😞 |
Oh wow, a lot of examples. Thank you for assembling this. Allowing users to define the season number as a parameter would be nice, but because we have to do this during the parsing time, it’s not really an option. We should provide a fixed set of regular expressions as you said, and wait for users to come and ask to extend it (no parameter to extend it at the beginning at least). |
While reading the changes I thought about the manual season definition again and I think it will not help. If the (123) annotated show is not season 1, the episode number would also be false. Maybe I miss something? And even if it is more work, having the season/episode info available as a filter for there case where it is defined properly would be just consequent. Applying it only for list/download is easier, but it will prevent some usecases. |
Good progress 🚀 |
Alright here is another update to the feature:
Next steps:
|
For the testing this should not be an command line parameter in my opinion. This tool has no tests as of yet, so there is no structure for it. But normally I use pytest to run doctests with a pytest.ini having For running pytest I normally use tox, but maybe this is too much for here. https://tox.wiki/en/latest/example/pytest.html |
Filtering and history are working now. I'm not sure about:
Next steps:
|
|
@fnep I'm done with the series mode feature. Please do a thorough review and let me know if anything needs fixing or improvement. Reminder for myself: we need to remove the |
mtv_dl.py
Outdated
@@ -39,6 +39,8 @@ | |||
|
|||
List options: | |||
-c <results>, --count=<results> Limit the number of results. [default: 50] | |||
--series Try to extract season and episode information from the title |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For listing, i would prefer to always show the columns. For Downloads it makes sense because of the movie / episodedetails difference, but here it is only cosmetics.
By the way, for me docopt is unable to have this parameter description twice. I need to remove one, otherwise is get --series is not a unique prefix: --series, --series?
. Did this work for you?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do you want me to strip the series_mode
flag and all the if-statements in the show_table
function as well? Or should we leave them in, just in case?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
And yes, this worked for me...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For me it looks like this:
> poetry run mtv_dl list --series
--series is not a unique prefix: --series, --series?
Usage:
mtv_dl.py list [options] [--sets=<file>] [--count=<results>] [<filter>...]
mtv_dl.py dump [options] [--sets=<file>] [<filter>...]
mtv_dl.py download [options] [--sets=<file>] [--low|--high] [<filter>...]
mtv_dl.py history [options] [--reset|--remove=<hash>]
mtv_dl.py --help
… yes i would also remove the if-statements and series_mode parameter there to be in line with the docs.
squashed changed for rebasing on master
36f9322
to
42a06c9
Compare
After enabling mypy and ruff, I had to fix a few things so that pytest is passing successfully again.
Hi Christian, Sorry it took me so long to get back to this issue. I'm ready to merge this … is there anything left you want to do before? |
No worries, I'm good with the changes, feel free to merge when you are ready. Do you want me to change anything else? |
No, it's all good. I was just a bit overloaded recently and want to catch up now. |
Start of the implementation of a "series" feature as discussed in #60 .
This feature provides:
--target flag
to name files based on {{season}} and {{episode}}What is not implemented:
list/dump
output.--target
name in--series
modePlease let me know what you think and if/in what direction to keep moving.
test.sh
script to test the new behavior. We need to strip this file before merging.