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
Generate playlists from songs listed in video descriptions #642 #649
Generate playlists from songs listed in video descriptions #642 #649
Conversation
ListView file was getting somewhat large, I wanted to split it up into separate files to make it easier to find the applicable datatype.
1, 2, 3, 7-11 etc
fetch_songs uses a series of regex expressions to filter out "artist - title" combinations from mixed text input.
Old generate_playlist function only used random playlist names. Defaults to random if no title is specified.
Extends mkp functionality by having it act on the --description parameter. When the --description parameter is passed, the software looks through g.model for suitable datatypes. It will find the first applicable object based on numerical input from the user, download that videos description and parse it for artist - track combinations, and will store that in a local playlist using the existing generate_playlist functionality.
Adds mkp to the search helptext keywords, adds --description help text. Changed some _len(varname) > 0:_ as this is the same as _if varname:_
Videos with track lists in the description generally have all those songs in them, right? So the point here is to find alternate versions that are individual tracks, so you can treat them as individual tracks? |
create_playlist(idx, title) | ||
|
||
data = [listview.ListSongtitle(x) for x in data] | ||
g.content = listview.ListView(columns, data, run_m) |
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.
This seems to result in a No objects in list
exception in some cases; I guess len(data)
needs to be checked?
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.
Yea, I guess if the software is unable to find any tracks, it would throw exceptions. I'll add a check for that.
Documentation? |
This seems like a fairly useful feature in certain cases; making it work reliably is difficult though. It seems to result in nonsense for videos that don't have track listings in their descriptions; perhaps that is acceptable, but it might be better to look for certain patterns and only match if it seems to have a track listing. That could potentially reduce the number of cases it matches successfully on, though. It also isn't working too consistently; videos like https://youtube.com/watch?v=_-sYj_1lADo don't match correctly even though there is a track listing. Ultimately there's a limit to how reliable it can be without hard AI though. |
One thing to do is to check for lines starting with times; those are a good indicator for a track listing. |
@ids1024 Yeah, correct. My personal use case was with EDM or other mixes where songs are often mashed together and/or mixed together to a coherent long mix, so if I find songs I like in a mix and want to listen to them with their proper start and end, I need to search for them separately. I didn't include straight up album searches, because we can already do that with the @rocketinventor Sorry, I'm new to all of this, anything in particular I should document? |
Yeah, albums are not the most useful example since I don't know how reliable this can be made; it is expected that it will no be entirely reliable. But some things to try:
|
For the regex, first check for (0-1) matches that look like a timestamp, than match for the song info after that. It might be a good idea to tie into some sort of music database and search that to figure out the exact song metadata. There is no guarantee that song info will be in any specific order or format. |
@Razesdark I would add something to the Readme explaining that this feature exists and explain the steps that need to be taken to use this feature (i.e. the commands that you typed in the gif that you shared). |
I noticed that there is some explanation of this feature at #642 but there is no mention of this feature in the Readme. New users will likely be unaware of this feature. |
2625fc3
to
c735b65
Compare
Ok, here is a updated version of the code. It tries to check each line and come up with a confidence index for wether or not it thinks the line is a song title or not. Then it takes the lines with an index above average, which I feel works because tracklisting formatting is usually consistent so all lines should be equally above average, as long as there is one line or more weighing down the average. Once it has the list that it percieves as song titles, it tries to determine if the line has the artist in it or not. Checks wether or not the results are consistent, removes inconsistent results if they are few, or exits if it finds too many of them. If it needs to find the artist name, it tries to parse the title by doing a youtube search on the title, then tries to repeatedly find the most frequent common string between a random subset of the results. Most of the time I tried this, it would only return the correct name, but sometimes it would have several results. (Like Best of, Album titles, etc), in the case of several alternatives, it will use the one that matches first in the original title. As I expect that the most common setup would be Artist name first. |
c735b65
to
271e6f5
Compare
271e6f5
to
3e885b6
Compare
@Razesdark Nice Work! |
As discussed in PR #642, I've extended the mkp function to allow users to make playlists from text found in video descriptions.
I have had the results pop up in a listview, so the user can inspect the parse before committing it to a playlist. Like any playlist selection, the user can select using numbers and ranges which songs they want to include in their playlist.
Finally I did some minor pylinting on the generate_playlist file.