z411 / trackma

Open multi-site list manager for Unix-like systems. (ex-wMAL)
https://z411.github.io/trackma
GNU General Public License v3.0
779 stars 82 forks source link

Play and episode recognition? #5

Closed IDex closed 10 years ago

IDex commented 11 years ago

Although the program is quite intuitive I feel like I've missed something important as I tried to use the "play" button beside the episode count in gtk gui and received a "Episode file not found." message. Is there a config I'm supposed to edit the location of my anime in, or set a media player? http://z411.github.com/wmal-python/ also talks about "Detection of running media player, updates list if necessary" but the program didn't react when I played the latest episode of Mangirl in mplayer.

z411 commented 11 years ago

Hi. Yes, you have to edit the config file, it's located in:

~/.wmal/config.json

and edit the line:

"searchdir": "/home/user/Videos"

and point it to the folder containing your files (it also searches subdirectories). I'm very sorry for not including any documentation on this. I'll make a Settings screen to change this configuration from inside the GUI.

Don't forget to change the "player" to point to your player of choice.

z411 commented 11 years ago

Hi again, I added a simple settings window in the GTK UI so you can change the settings easily. It's in the menu Options -> Global Settings.

I pushed it to master. Please tell me if it works.

IDex commented 11 years ago

The play button works great now, as does setting them through Global Settings, thanks.

However, it would probably be even better if the play button played the next episode by default instead of the current one. At the moment when I wish to play the next episode of a series, eg. I've seen 4/13 and want to watch the 5th episode, I first have to increase the "progress" field value by one from 4 to 5 and then click play.

z411 commented 11 years ago

Glad it works.

Yeah, the curses interface does this but the GTK doesn't. What if I added a "Play Next" button next to "Play" button? "Play" button would play the episode chosen in Progress and "Play Next" would play the next episode you haven't seen yet. Is that okay?

Also, is the play tracker working? It may take up to 2 minutes to recognize the media player though, if you want it to recognize it quicker you can reduce the "tracker_interval" (seconds).

IDex commented 11 years ago

The "Play Next" button sounds like a good idea.

If by the tracker working you mean the program asking me if I want to update the episode when the player closes then yes, as long as I start watching the episode using the Play button, wmal doesn't react if I start playing the episode manually.

I don't know if it's ok for me to keep throwing these suggestions at you, but another possible improvement would be a some kind of indicator for a series that has local unwatched episodes waiting to be watched. I find myself frequently checking my torrent client for unwatched episodes as I can't remember which I've downloaded.

z411 commented 11 years ago

If by the tracker working you mean the program asking me if I want to update the episode when the player closes then yes, as long as I start watching the episode using the Play button

By tracker I mean wmal detecting that you have a media player playing in the background. If you start playing an episode outside of wmal (without the "Play" button) wMAL should react to it after a while and show in the status text "Detected player for show ----, updating in ## seconds..."

wmal doesn't react if I start playing the episode manually.

This is weird, the probability of this working should be higher than the "Play" button as it uses fuzzy matching. Please keep in mind that it might react up to 2 minutes after opening the video. If you dislike this, close wmal, try decreasing the "tracker_interval" in the config and open wmal again.

I don't know if it's ok for me to keep throwing these suggestions at you,

Of course, that's what this space is for. Keep 'em coming.

but another possible improvement would be a some kind of indicator for a series that has local unwatched episodes waiting to be watched.

Yes, you can actually do that in the CLI (wmal) by issuing the command "neweps". It's currently pretty slow so I have to find a way to optimize that and implement it in the GTK and curses interfaces.

IDex commented 11 years ago

This is weird, the probability of this working should be higher than the "Play" button as it uses fuzzy matching. Please keep in mind that it might react up to 2 minutes after opening the video. If you dislike this, close wmal, try decreasing the "tracker_interval" in the config and open wmal again.<

I tried playing an episode of Tamako Market (~20mins) with the following config and the program status stays at "Ready.", when I started playing the episode by using "Play" the player opened right away.

"auto_status_change": true,
"autopush": false,
"debug_disable_lock": true,
"player": "mplayer",
"push_on_exit": true,
"searchdir": "/home/IDex/Anime",
"tracker_enabled": true,
"tracker_interval": 60,
"tracker_update_wait": 2
z411 commented 11 years ago

I see. Mhm.

Do you have "lsof" installed? What happens when you run "lsof" in the terminal? And what is the filename of the episode?

IDex commented 11 years ago

I get lots of output of some kind. [Commie] Tamako Market - 04 [4BC1E208].mkv

z411 commented 11 years ago

Mhm, it's working for me. If you run wmal-gtk from the console, do you get some output from the console of any kind when playing the video? Is the file in the "searchdir"? Are you using "mplayer"?

Sorry for all the questions, I appreciate your feedback as it'll help me iron out the bugs.

IDex commented 11 years ago

IDex@Ganbaru ~ $ wmal-gtk <----- here I started wmal /home/IDex/.wmal/accounts Starting engine... Locking database... Reading cache... clearing gui select show select show start select show start done Searching for Tamako Market 3... <--- here I pressed the play button Found. Starting player...

Yes, the episode is in searchdir(which is a symlink that leads to another partition though) and I'm using mplayer from cli.

IDex commented 11 years ago

So there doesn't seem to be any signs of recognition from the output.

z411 commented 11 years ago

Oh I'm talking about running the external player manually without using the "Play" button. If you use the "Play" button the tracker gets deactivated until you close the player.

Well, I'm guessing "tracker_enabled" is set to true, right? I might add some logging features if you're willing to help me debug, because I can't reproduce the problem...

z411 commented 11 years ago

Oh and thanks a lot for your feedback. I also added the Play Next button in the latest commit.

IDex commented 11 years ago

I should have made it clearer, the output I posted above was from the following instance:

I watched an episode of Tamako Market (~20mins) with the following config and the program status stays at "Ready.", when I started playing the episode by using "Play" the player opened right away.<

So any potential output from playing the episode outside wmal should be visible in between me starting wmal and using the play button.

I'm using the config I listed above, so yes, tracker should be enabled.

Logging sounds like it'd help both of us(and other people reporting bugs). I'm now using this program for anime watching so I should be able to help debug at least every now and then when bugs come across.

IDex commented 11 years ago

The 'play next' works perfectly.

z411 commented 11 years ago

I was thinking, you said you had a symlinked folder. Maybe you're playing the video from the original folder instead the symlinked folder? If that's the case, then mplayer is reporting the video file "/mnt/part/original_folder/video.mkv" instead of "/home/IDex/anime/video.mkv". If that's true, then wMAL is ignoring it completely.

Is this the case? The behavior of wMAL is that it reacts to the player only if it's playing a file that's inside of the searchdir. I guess I should change this behavior to detect a video playing from anywhere in the system?

And yes I'll work on an option to enable verbose logging for debugging.

IDex commented 11 years ago

Changed the location in the config to "/mnt/D0C0F4A3C0F49148/Media/Anime" and received a row of following messages while watching "[EveTaku] GJ-bu - 04 (1280x720 x264-Hi10P AAC)[6B8288A8].mkv"(also tried play button and it found the episode). No other reaction from wmal.

   "Regex error. Check logs."

Tried using mplayer both through the /mnt/... and the symlinked paths, the result was the same. I'm not sure what logs are being referenced so I can't paste them here.

z411 commented 11 years ago

I see, so it seems wMAL is now reacting to your player but couldn't extract the show name and episode number from the filename correctly, due to the admittedly primitive regex.

z411 commented 11 years ago

Okay, it was having problems with the "-" in the GJ-bu title since "-" is a Showname - Episode separator. I commited a hotfix for this so it should work with GJ-bu, although it may break with releases that don't have the "-" to separate the episode from the show name.

Please tell me if it works, I'm still working to improve the tracker recognition since it's still pretty basic.

IDex commented 11 years ago

To fix the first problem, I'll modify the tracker so it reacts to a file anywhere in the system, doesn't matter the folder. Is this ok?<

This would be nice.

And yes, the player recognizes GJ-bu now.

IDex commented 11 years ago

Another recognition problem. wmal can't find episode of "Puchimas!: Petit iDOLM@STER" when using Play button and when outside wmal the output is: Found player but show not in list. The file name format is: [Chibiki] Puchimas! - 01 [360p][EB76BA61].mkv

z411 commented 11 years ago

Yeah, that's because the episode name is too different to the name in MAL.

MAL Name: Puchimas!: Petit iDOLM@STER Filename: Puchimas!

It's kinda hard to fix it in these cases, another worse problem happens with the show "Space Brothers":

MAL Name: Uchuu Kyoudai Filename: Space Brothers

I still can't think of a solution for these cases. I don't know how MAL Updater does it (but I remember it had this problem too), and Taiga has an "Alternative name" option to give the shows in your list alternative names so the tracker can find it.

I have to think of a solution for this, sorry. Any suggestions on how to do it?

IDex commented 11 years ago

The alternative/override name doesn't sound too bad and is probably easier to implement than fetching alternative names off myanimelist(I don't know the API though it could be easy) or doing some kind of regex magic, and is probably more reliable.

MalU has the alternative name option too.

z411 commented 11 years ago

Both sound like good solutions so I think I'll implement both.

fetching alternative names off myanimelist

wMAL already does this and keeps them in memory, it's just that it doesn't use them for the search. I'll try it. If it's not too slow I'll keep it.

MalU has the alternative name option too.

Oh, I didn't know this. I'll work on this too.

IDex commented 11 years ago

Just in case you got notified about my last two comments, which I removed: I managed to somehow break wmal. False alarm.

z411 commented 11 years ago

I got to read them anyway heh.

I managed to somehow break wmal.

What do you mean? Did you fix it?

KeyError: 'aliases'

This error happens not because of the hyphen, but becase I added 'aliases' to the database just now, so you have to re-download the list (Options -> Retrieve List). Sorry for not telling you, I should handle those errors somehow.

About releases without hyphen, I think I can fix that without breaking support for shows like GJ-bu.

IDex commented 11 years ago

What do you mean? Did you fix it?<

Couldn't start the program, got an error. Deleted .wmal along with all other wmal files/folders, reinstalled and it works great again.

This error happens not because of the hyphen, but becase I added 'aliases' to the database just now, so you have to re-download the list (Options -> Retrieve List). Sorry for not telling you, I should handle those errors somehow.<

Just wondering, why not make it try to auto-retrieve the list on start-up, or auto-send after watching an episode?

About releases without hyphen, I think I can fix that without breaking support for shows like GJ-bu.<

That would be great.

z411 commented 11 years ago

Couldn't start the program, got an error. Deleted .wmal along with all other wmal files/folders, reinstalled and it works great again.

Oh, that shouldn't have happened. If it ever happens again please post an issue with the error.

Just wondering, why not make it try to auto-retrieve the list on start-up, or auto-send after watching an episode?

I plant to implement this, but not as default. I opened an issue about this, we can discuss it there: https://github.com/z411/wmal-python/issues/6

IDex commented 11 years ago
[FFF] Sasami-san@Ganbaranai - 04 [4A2AF45E].mkv

Another recognition problem, I'm guessing because of the @. Episode is still found using the Play Next button though.

Output:

Regex error. Check logs.
z411 commented 11 years ago

IDex, the bug was fixed, shows with @ character should work now (develop branch).

IDex commented 11 years ago

Tried to use the Play Next to play episode 4 of Sasami-san@Ganbaranai([FFF] Sasami-san@Ganbaranai - 04 [4A2AF45E].mkv) and the player started the first episode([FFF] Sasami-san@Ganbaranai - 01 [1D04EB8D].mkv), upon closing it still asked if I wanted to update the progress to 4th episode. My guess would be that "04E" in file name caused this.

When I started to play externally it worked ok, and recognized the episode correctly as the 4th one.

z411 commented 11 years ago

Oh, this has happened to me and I fixed it but I didn't commit it for some reason.

IDex commented 11 years ago

Not sure what is causing it, but using the "play" keys in wmal-gtk gives "Episode not found" on every episode even ones that used to work fine. Wmal still recognizes episodes when played externally though. Edit: Most likely related to #7 as the path length is 34.

IDex commented 11 years ago

On another note tracker outputs "Engine: Regex error. Check logs." when playing "[Doremi].Hyouge.Mono.22.[8C3E9D67].mkv".

z411 commented 11 years ago

Not sure what is causing it, but using the "play" keys in wmal-gtk gives "Episode not found" on every episode even ones that used to work fine. Wmal still recognizes episodes when played externally though. Edit: Most likely related to #7 as the path length is 34.

Thanks for pointing it out, will fix.

On another note tracker outputs "Engine: Regex error. Check logs." when playing "[Doremi].Hyouge.Mono.22.[8C3E9D67].mkv".

Weird... the filename seems pretty standard, I don't think the dots would cause that as I've played other episodes with dots in it fine... Will look into it, thanks.

YogSottot commented 10 years ago

[Regex error] [OZC]Mobile Suit Gundam Wing Endless Waltz Remastered E01 'Silent Orbit' [2013].mkv [Regex error] [EG]Turn-A Gundam 01 V2[E8F575A6].mkv [Regex error] Lupin III Part II - 072.avi

z411 commented 10 years ago

Closing in favor of https://github.com/z411/wmal-python/issues/42.