Open AlickH opened 2 years ago
Yeah, we probably could do it instead of reading the path. But the issue is deciding between the two. I've found that many a time, the Media Title does not contain meaningful information (eg: Only the episode title, but no show name). We can't simply stop using the path for extracting info and switch to title. And in cases where both contain partial info, one of which is wrong (eg: Weird url from which we somehow extracted some gibberish, but valid info - remember, this is all powered by regexes at the core), how do we decide what to use?
This was my original motivation for choosing path instead of title, since that is something that the user could control (for any media player). But now that we have streaming support from the web, this assumption doesn't hold true. However, I'm not sure on how to fix this without requiring a lot of manual intervention.
Some possible solutions-
Maybe could combine this with whitelist to choose which path or url to use path or title, or let user to write it to config file to choose title or path, or popup a dialog box to choose which to use when there are two options.
popup a dialog box to choose which to use when there are two options.
That is way too intrusive. I would like the scrobbler to not require manual intervention, especially on every file.
let user to write it to config file to choose title or path
Yeah, this seems feasible. Will try implementing it when I get some free time.
I came to ask about this as well. Apparently when i'm streaming some content it only picks up filename from the IPC socket for scrobble instead of media-title
As stated above, my main worry with this is making the configuration too manual. But now that #214 has been implemented, we have a pretty powerful way of specifying how to remap raw media info. Currently, the feature only works on info extracted from file paths, but it should be relatively easy to extend that to file title retrieved from mpv. Will try to work on this soon.
I have implemented an initial version of this feature in the title-extract branch.
If the title provided by the media player is present in fileinfo.title_whitelist
sequence, it will be used to extract info instead of file path. There is currently no way to merge the infos extracted from title and path individually.
Install from branch:
trakts stop
pipx install --force --pip-args='--force-reinstall' git+https://github.com/iamkroot/trakt-scrobbler.git@title-extract
trakts start
Configuration: trakts config set --add fileinfo.title_whitelist "Some Name"
Now, any media that contains "Some Name" in the title will use that title for metadata.
Please give it a try and let me know if everything is working as expected.
@AlickH @umop3plsdn would appreciate your feedback on the design!
Sorry didn't see this until today.
2023-01-12 09:12:32,067 - WARNING - scrobbler - trakt_interface - Invalid trakt id for 1649804033 2023-01-12 09:12:32,067 - ERROR - scrobbler - init - Unhandled exception Traceback (most recent call last): File "/usr/lib/python3.10/threading.py", line 1016, in _bootstrap_inner self.run() File "/home/da5id/.local/pipx/venvs/trakt-scrobbler/lib/python3.10/site-packages/trakt_scrobbler/scrobbler.py", line 36, in run self.scrobble(verb, data) File "/home/da5id/.local/pipx/venvs/trakt-scrobbler/lib/python3.10/site-packages/trakt_scrobbler/scrobbler.py", line 78, in scrobble resp = trakt.scrobble(verb, **data) File "/home/da5id/.local/pipx/venvs/trakt-scrobbler/lib/python3.10/site-packages/trakt_scrobbler/trakt_interface.py", line 48, in wrapped verb, params = next(coro) StopIteration
also its still picking up the same thing: trakts test mpv Testing connection with mpv. Please ensure that mpv is playing some media.
echo '{"command": ["get_property", "media-title"]}' |socat - /tmp/mpvsocket {"data":"bleach-episode-7-dub","request_id":0,"error":"success"}
Sorry, that was a small bug in the code. I've pushed a fix. Please re-install using the instructions above.
alright reinstalled and it looks like its still pulling off the same location. for the record i double checked that the changes you pushed out were actually present in /home/da5id/.local/pipx/venvs/trakt-scrobbler/lib/python3.10/site-packages/trakt_scrobbler/player_monitors/mpv.py just to double check since it was the same result. Also, to help i tried a youtube vid randomly https://www.youtube.com/watch?v=djA0fYk65yI trakt-scrobbler on title-extract via 🐍 v3.10.9 ➜ echo '{"command": ["get_property", "media-title"]}' |socat - /tmp/mpvsocket {"data":"Destiny Reacts To Boyinaband Allegations","request_id":0,"error":"success"}
➜ trakts test mpv Testing connection with mpv. Please ensure that mpv is playing some media.
Are you sure you've added that title to fileinfo.title_whitelist
config as mentioned in the steps above? Please check the scrobbler logs too.
omg i didn't see that part i am so sorry! i can't believe i missed that entirely wow. Even the install method is easier than how i was doing it locally lol. So would it be trakts config set --add fileinfo.title_whitelist "media-title"?
Yep
Can you see if I did anything wrong?
I did stop/start trakts after for the record and got the same result lol. I tried off the metadata field as well since this is the output i get with socat on mpv socket: {"data":{"major_brand":"isom","minor_version":"512","compatible_brands":"isomiso2avc1mp41","title":"Vinland Saga - S01E20","encoder":"Lavf58.29.100"},"request_id":0,"error":"success"} but i got the same Playing 7c4f45. Could it still be getting it correctly just not outputting the right thing with the test flag?
You don't add the string "media-title" to whitelist. You need to add the name of the show. For the pic you shared, it would be trakts config set --add fileinfo.title_whitelist "Vinland Saga"
thank you for clarifying! I almost thought it was that but then I second guessed and thought it was the field of choosing. Do I need to put how it shows up for media-title? for example from below "vinland-saga" all lower case or like you said "Vinland Saga"? I tested the below with "Vinland Saga". Also, I can test with another source if you think that might be the issue? Thank you for all the hard work I hope i'm not discouraging you. I'm trying to provide you with as accurate info as I can. trakts test mpv Testing connection with mpv. Please ensure that mpv is playing some media.
Sweet it works on bleach! thanks for all your hard work! also i added whitelist lowercase just vinland one word and that worked too
Ah thanks for catching that. Maybe we should do case-insensitive comparison for matching titles.
Sometimes the url stream link did not contain the file name, but mpv can set the media title through m3u list or by
--force-media-title
command.