NISH1001/playx

Release: First release of playx

Closed this issue ยท 30 comments

After doing few major testing on functionalities, I will try to do the first release for playx.
During that I will also merge the current develop to master if the code is stable enough!

@deepjyoti30 If there are some issues you encountered from your side, please let's continue the conversation in this thread!

I haven't really faced any issues. Just that the output can be made better for a stable release.
For me, when i play a song the data that is shown looks really messy. A lot of that probably comes from that huge youtube audio link, i think it shouldn't be shown in the output.
Other than that i think we should add a logger because that would help us debug better.
Also you have mentioned adding a feature of suggesting songs. I think that would be a pretty good feature. Like if we play a song than it will continue playing related songs unless we pause it.

I was just wondering we can also add support for billboard charts. Like if the name passed is any of the billboard charts name then all the songs in that chart will be played one by one. How about that?

Regarding the output, yeah I also feel like stripping many output (although keeping MPV more verbose regarding seek, volume, etc).

Regarding the song suggestion, my original intention was to use a very naive machine learning (doesn't even have to be ML) by analyzing the log activities of songs played and then suggesting the songs based on certain time, frequency, etc.
Example:
If I play songs from Nirvana, Opeth, etc, often than others the engine might suggest some songs from them.
Although billboard charts also sound good enough for now. How about doing that after the first release?
Next release might be more "intelligent" playx.

About Logger:
Do you have already done the logging in your repo ytdl?

I haven't added a logger. Though i added Billboard support. Actually i already had made a simple API to access Billboard charts so i used it to get the data inside playx. Its working all right now. It was just a simple addition. I think you can add the billboard feature in the first release.
Suggestion sound good to me the way you mentioned. But we need to make it better with time though.

I think we can simply create a file in the .playx folder that would save song names. Like we can make playx write the name of the song to the file before playing the song. Later we can use those names as input for the learning algo for suggestions. How about that?

Actually, I have done the same for my bash session (and commands). Hooked some bash command to bashrc and then it has been logging my history daily. Meanwhile, I was able to create some bash completion engine using markov models along with some habit analyzer.

Maybe we can do similar stuff! Like just direcly throwing anything that has been send to playx via cli.
Or even better, as you mentioned, dumping in the name to a file along with a format (maybe) like:
[timestamp] - song name

Let's do the conceptualization currently without coding. Maybe we might be able to come up with an intuitive solution for hooking the logging part into it!
(I am kind of like a slow thinker :) )

I also think we should add a option to let the users choose the media player. Like mpv, mpd plays pretty much the same way and mpc actually makes it better. We can ask the user to select a player in the begining or simply read from a config file stored in .config.

I have updated the cache directory to ~/.playx/songs because we will add ~/.playx/logs for logging and might able to add config.json too...

I have to refactor the whole code before doing all the config stuff.

What options are you going to add to config to be changed?? Why do you need to refactor everything??

The code seem to be cluttered and inconsistent for parsing the cli! I will refactor that into more consistent form! I am hopeful that there's more room for cleaning up the code!

Maybe
I am thinking of creating a Playx class of which there will olny be one singleton object that handles the parsing and looping through the songs. Also the parsing for local playlist and billboard are happening in two different places. I think there's more room for unifying that too.
[Just my viewpoint]

About Config
It can be simple JSON file with some value like player, etc.

About Improvement in the Code

These are the views from my side:

  • The parser for song, playxlist, youtubeplaylist, billboard can be unified
  • we can remove some intermediate function calls to remove the dependency of going down the rabbit hole
  • we can create a singleton object of type Playx that handles the parsing and running the program according to config. This might be more approachable solution to handling increasing number of functions in main.py to seggregate the logic and de-clutter the actual main.py
  • I have been experimenting with my own custom logger for logging user activities that is able to log activities in the form: <timestamp> <play_mode> <cli_arguments passed>

@deepjyoti30 Are there any bugs in playlist functionalities? I am planning to do a major release this week.
Following are the things I have observed:

  • logger seems to working fine
  • youtube crawling is good enough (for now)
  • billboard seems to be fine while testing

I think if there are no any other issues regarding different playlists modules, we are good to release this week. In the process, I will merge the "stable" code to master.

I am focusing on auto-generated playlists using markov chains. So, that will my next target for upcoming month. It will a good integration and feature for playlist - playing auto-generated playlist based on logs.

Adding on top of previous comment, our next major release (after aforementioned release) will be an overhaul to the overall code and architecture. Like making a good architecture for plug and play modules. That will be good for any other features to be added in some (near or far) future.

I think playlists are working good.
Soundcloud songs are mostly not available on youtube so i the extractor also extracts a soundcloud URL to stream however those URL's are really slow. I don't know if its just me but every time i stream from them, they always pause after a few seconds and again start playing.

Other playlists are working fine. I think i will stop adding album name to gaana playlists because i noticed
they make the search irrelevant sometimes.

You do that auto generated playlist thing and tell me if theres anything i can do. I am really bored w/o no work right now.

@NISH1001 About the changes to code, i think we need to organize stuff in the stringutils and cache files and others that were defined in the beginning and have not been changed much. I think the playlist files are
okay. Also what do you think about the player?
I think its better than the way we used earlier like checking everything in main.

@deepjyoti30 Sure. First let me review everything. :D
Trying to refactor code. The project has grown large. I still haven't tested other playlists. I will get back to this thread once I test all the playlists modules.

@deepjyoti30 can you test the all the playlist modules for any type of bugs. I have implemented a simple auto playlist. I will do Markov Chain based generation in upcoming days.
For now, the simple auto-playlist can be found here. You can try it out and let me know in this thread. I will do more state machine based playlist in upcoming days.

Cheers...

@NISH1001 Just checked.
Its good but i don't think thats what you wanted to do. I mean you wouldn't add a counter based playlist suggestor to the final version right.
Also will it always recommend the songs that are already played or other songs too? Like you can try to suggest related songs by getting song data from some API?

How would the release version of the auto playlist work like.?
I mean i don't think it will be a good idea to write to an .playx list and read from them so we can actually add support for an internal playx list, that the player can parse directly. And will start playing after the current song is done playing?

@deepjyoti30 Yes it's just a Proof-of-Concept. However I will not be using any API for now. That will create too much dependencies on the 3rd party.
Regarding playxlist, there isn't any interface in current implementation for providing a list of song names. It's using file to directly parse it. Hence, for prototyping I directly wrote to the file. We should do something about this. Maybe we can re-write the constructor as:

class Playxlist:
    def __init__(self, content, ...):
        # if content is a string, parse it
        # else it should be a list of string...

That will solve the problem.

Edit:
I have refactored the code to accept a path or list of strings. Auto-playlist is working without writing to file.

@NISH1001 Just Checked, its working all right.
But i think the final feature should be something like the following.

The user plays a song and playx does everything same till the song starts playing.
Just after the song starts playing, the playlist is generated in the background and the all the songs are played after that. We can also add an argument to stop this behaviour.

@deepjyoti30 I will think about that. Although concept sounds good enough, it will divert the mind from focusing on the main algorithm. We might not need that for now, at least what I have in my mind. First I have to refactor the whole codebase. It's getting messier. There are many places where code need refactoring. I think I will focus on that for now.

Edit:
I am trying to implement a good pattern for plug and play modules so that any new features can be added smoothly without going overboard.

If everything is working fine, I will do the next release this week. Still, haven't allocated time to test the other playlist modules. But I will surely test them.

@NISH1001 Can you tell me where the code is messy? I mean i think the playlist files are clean. Just tell me and i will try to make changes.

The code where we are trying to fix the start and end marker. It can be made much cleaner, shorter. Too much of code there. Can you try to make changes there? I think, it needs refactoring. Other than that, I will let you know more code reviews so that we will be able to finalize the codebase for the upcoming release.

@NISH1001 You mean the one where we strip the playlist according to the passed pl-end and pl-start arguments? Will do that.

@deepjyoti30 Yeah. I find the code messy. It can be improved. Similarly, try refactoring other code in playlist modules too. I will create another thread for refactoring the code. We can move the conversation there.

@deepjyoti30 I will close this issue for now.