Comments (60)
One more thing you can try, is in the plist file, replace
poetry
with/usr/local/bin/poetry
and then reload the service. Maybe that might work. (Check logs to confirm)
Hi @iamkroot !
Bingo! This is working :) (El Capitan 10.11.6 (15G22010)
Thank you!
from trakt-scrobbler.
I'm monitoring this issue, because I have the same problem on my new Ubuntu install. :)
from trakt-scrobbler.
Aha! There we go. Looks like there's no python
executable inside the virtualenv.
I'll push a fix for this soon. Till then, if you want to test, open up ~/Library/LaunchAgents/trakt-scrobbler.plist
file and replace python
with python3
and save. Then load and start the service again and it should work.
from trakt-scrobbler.
@prabapro One more thing you can try, is in the plist file, replace
poetry
with/usr/local/bin/poetry
and then reload the service. Maybe that might work. (Check logs to confirm)Hey @iamkroot ,
After replacing
poetry
with/usr/local/bin/poetry
& loaded & rebooted, the system log is as below;Jan 16 20:56:28 Prabas-MacBook-Air com.apple.xpc.launchd[1] (com.github.iamkroot.trakt-scrobbler): This service is defined to be constantly running and is inherently inefficient. Jan 16 20:56:31 Prabas-MacBook-Air com.apple.xpc.launchd[1] (com.github.iamkroot.trakt-scrobbler[1351]): Service exited with abnormal code: 1
Here's the content of my
trakt-scrobbler.plist
file;<?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> <plist version="1.0"> <dict> <key>Label</key> <string>com.github.iamkroot.trakt-scrobbler</string> <key>ProgramArguments</key> <array> <string>/usr/local/bin/poetry</string> <string>run</string> <string>python</string> <string>main.py</string> </array> <key>WorkingDirectory</key> <string>/Users/codechilli/Library/trakt-scrobbler</string> <key>RunAtLoad</key> <true /> <key>LaunchOnlyOnce</key> <true /> <key>KeepAlive</key> <true /> </dict> </plist>
PS: @mastaka's plist file is little different from mine. Could that be a reason for this? I'm running on
Catalina OS X 10.15.2
Hey @iamkroot & @mastaka, happy news 👍 Managed to get this worked successfully. Ran poetry install
inside the installation dir, viola 🎊 Thanks heaps boys!!!
from trakt-scrobbler.
@prabapro Try loading the service first, then run the previous command. Maybe that will help
@iamkroot No luck bro :(
from trakt-scrobbler.
@iamkroot I'm sorry, I don't know how to do this. If you don't mind, could you kindly let me know the steps to be follow please. Appreciate it.
Sorry I should've explained better. You just need to:
cd
to/Users/codechilli/Library/trakt-scrobbler
- run
/usr/local/Cellar/python/3.7.6_1/Frameworks/Python.framework/Versions/3.7/bin/python main.py
command directly. (See scrobbler logs to confirm it works)
from trakt-scrobbler.
Could you check if /Users/codechilli/Library/Caches/pypoetry/virtualenvs/trakt-scrobbler-SsqFgJVg-py3.7/bin/
exists and contains a python3
file? Also, try running /Users/codechilli/Library/Caches/pypoetry/virtualenvs/trakt-scrobbler-SsqFgJVg-py3.7/bin/python3 main.py
from inside /Users/codechilli/Library/trakt-scrobbler
from trakt-scrobbler.
@prabapro Let's give it one more try, in the installation dir, run poetry run python main.py
and check log to see if it works. (No need to reboot)
from trakt-scrobbler.
Ah progress 🎊
I'm not exactly sure why you're getting that TypeError
(seems to be working fine in my system), but we might have a solution for your installation errors.
In your plist file, replace
<key>ProgramArguments</key>
<array>
<string>/Users/codechilli/Library/Caches/pypoetry/virtualenvs/trakt-scrobbler-SsqFgJVg-py3.7/bin/python3</string>
<string>main.py</string>
</array>
with
<key>ProgramArguments</key>
<array>
<string>poetry</string>
<string>run</string>
<string>python</string>
<string>main.py</string>
</array>
And then load the service using launchctl
and reboot. Then check logs to see if it worked.
from trakt-scrobbler.
Closed by mistake, sorry.
from trakt-scrobbler.
Hey @iamkroot , happy news 🥳 both the VLC & Plex are getting scrobbled now.
Only issue we have right now is the plist file.
For the time being I'v set up an alias in bash_profile
to run cd /Users/codechilli/Library/trakt-scrobbler && poetry run python main.py
Alternative solution
Created an Automator task as below (for both VLC & Plex);
Now, whenever I start either VLC or Plex, the scrobbler starts automatically :)
from trakt-scrobbler.
Created an Automator task as below (for both VLC & Plex);
Now, whenever I start either VLC or Plex, the scrobbler starts automatically :)Hi! I can’t understand how to make it so that when starting the VLC the script just runs, instead of starting the service or application created in the Automator?
How do you save this code for Automator?P.S. Sorry, if my questions seem stupid, I am poorly versed in the Automator, and even more so in programming.
Hi @mastaka, as you mentioned above running poetry run python main.py
in the installation directory is the only option I do have right now. I'm also new to Automator & managed to come up with this after reading a few stuff from the Stakeoverflow. I don't know the pros/cons of this method but @iamkroot would be able to enlighten us on this. Below are the steps I used to achieve this, FYI.
So the idea is to setting up a workflow where once we open the VLC, automator will trigger the poetry run python main.py
automatically.
- Launch the Automator app >
Workflow
> Choose - In the search bar, type
launch
- Double click on
Launch Application
- Select
VLC
in the dropdown (right hand pane - you might have to click onother
& choosevlc.app
) - Again on the left pane, search
run
& double click onRun Shell Script
- Make sure the shell selected is
/bin/bash
- Type your terminal command here. First we need to
cd
to the installation directory followed bypoetry run python main.py
command. Butpoetry
doesn't work inside the automator. So we have to replacepoetry
with it's path. To do that, open up a Terminal window and runwhich poetry
- in my case the path is/usr/local/bin/poetry
- So here is the format:
cd <installation dir> && <poetry path> run python main.py
. - For me it's like
cd /Users/codechilli/Library/trakt-scrobbler && /usr/local/bin/poetry run python main.py
- Now go to
File
>Save
- Once saved, launch the VLC & play a video & check the
trakt_scrobbler.log
for the status.
from trakt-scrobbler.
@prabapro thank you very match for such a detailed tutorial!
I probably didn’t put it right, sorry. I created my workflow after your first comment about the Automator, but the problem is that it only works inside the Automator. Or if I save it as an application or service and run it.
But if, after saving the workflow , I just start the VLC, then scrobbling does not occur.
from trakt-scrobbler.
@prabapro That is what I had in mind. Since you have not indicated anywhere that you are launching the application saved from Automator (yes, this also works for me).
But from your words, I thought that you just start the VLC as usual, and after that the script for scrobbling is automatically launched — therefore I couldn’t understand how you do it :D
Thanks for the detailed answers! We just did not understand each other :)
from trakt-scrobbler.
@prabapro That is what I had in mind. Since you have not indicated anywhere that you are launching the application saved from Automator (yes, this also works for me).
But from your words, I thought that you just start the VLC as usual, and after that the script for scrobbling is automatically launched — therefore I couldn’t understand how you do it :D
Thanks for the detailed answers! We just did not understand each other :)
Hey @mastaka , no worries :)
I think we have to run the app created by the Automator only once (after each reboot). Thereafter opening the VLC normally would trigger the scrobbler. No need to launch the created app every time. I'm not sure about the reason behind this :)
from trakt-scrobbler.
@prabapro Although this is a “crutch”, but in this case the problem can be solved as follows.
Create an application in the machine with a script only and add it to autoload.
After the restart, the script will be executed, and scrobbling will work, and if necessary, the script can be interrupted through the gear.
from trakt-scrobbler.
@prabapro Although this is a “crutch”, but in this case the problem can be solved as follows.
Create an application in the machine with a script only and add it to autoload.
After the restart, the script will be executed, and scrobbling will work, and if necessary, the script can be interrupted through the gear.
@mastaka wow, this is awesome. Let me follow this. Thanks heaps :)
from trakt-scrobbler.
Hey @prabapro sorry for the delay. Does tail -f /var/log/system.log
give any details regarding the service after you load the new plist file?
from trakt-scrobbler.
Woohoo! I'll push an update ASAP with the updated code. Thanks for confirming @mastaka
from trakt-scrobbler.
@prabapro Let's do some diagnostics.
cd
to /Users/codechilli/Library/trakt-scrobbler
and run poetry env info
. Could you paste the output here?
Also, paste the output of poetry debug
. That might help too.
from trakt-scrobbler.
/Users/codechilli/Library/trakt-scrobbler
Hi @iamkroot ,
thanks for helping me further. Here is the output;
Env info
Virtualenv
Python: 2.7.16
Implementation: CPython
Path: NA
System
Platform: darwin
OS: posix
Python: /System/Library/Frameworks/Python.framework/Versions/2.7
Debug
Poetry
Version: 1.0.1
Python: 2.7.16
Virtualenv
Python: 2.7.16
Implementation: CPython
Path: NA
System
Platform: darwin
OS: posix
Python: /System/Library/Frameworks/Python.framework/Versions/2.7
from trakt-scrobbler.
Python: 2.7.16
There's the main problem. It's using python2 as default for some reason.
Try poetry env remove 2.7
, followed by poetry env use 3.7
. Then run the poetry env info
and install script to see if it works.
from trakt-scrobbler.
Hi @iamkroot ,
Thank you for your extended support. I've uninstalled the python3 & poetry and reinstalled both via brew. Now the installation is completed successfully & restarted the machine. Tested with playing videos on both the VLC & PLEX, but nothing is getting updated on Trackt. Is there any other way that I can see whether this one is working successfully?
Below is the log fyi.
2020-01-11 13:34:58,735 - DEBUG - MainThread - utils - /Users/codechilli/Library/Application Support/trakt-scrobbler/trakt_cache.json doesn't exist.
2020-01-11 13:34:58,735 - DEBUG - MainThread - utils - /Users/codechilli/Library/Application Support/trakt-scrobbler/trakt_token.json doesn't exist.
2020-01-11 13:34:58,735 - INFO - MainThread - trakt_interface - Access token not found in config. Initiating device authentication.
2020-01-11 13:34:59,579 - INFO - MainThread - trakt_interface - Verification URL: https://trakt.tv/activate
2020-01-11 13:34:59,579 - INFO - MainThread - trakt_interface - User Code: 00D317CF
2020-01-11 13:35:01,021 - DEBUG - MainThread - trakt_interface - Waiting for user to authorize the app.
2020-01-11 13:35:06,678 - DEBUG - MainThread - trakt_interface - Waiting for user to authorize the app.
2020-01-11 13:35:12,557 - INFO - MainThread - trakt_interface - Device auth successful.
from trakt-scrobbler.
@prabapro Good to hear that you were able to get it installed.
Looks like a problem with the background service not starting. That part isn't tested that well on Mac, so you're gonna have to help me here a bit.
What does launchctl list | grep com.github.iamkroot.trakt-scrobbler
show?
from trakt-scrobbler.
Hi @iamkroot , sure, it's my pleasure to help you to test this out. Getting nothing for launchctl list | grep com.github.iamkroot.trakt-scrobbler
.
However, not sure if this information would help you. I'm using CleanMyMac app & it shows the plist item but disabled. I tried to enable it on the app itself, but when I restart, it still shows as disabled.
from trakt-scrobbler.
Maybe the service is crashing. Try tail -f /var/log/system.log
. You could also use the Console.app
for debugging this.
from trakt-scrobbler.
Hi @iamkroot ,
from trakt-scrobbler.
@prabapro Let's do some diagnostics.
cd
to/Users/codechilli/Library/trakt-scrobbler
and runpoetry env info
. Could you paste the output here?Also, paste the output of
poetry debug
. That might help too.
Could you run these commands again and paste the output now?
from trakt-scrobbler.
Here we go;
Prabas-MacBook-Air:trakt-scrobbler codechilli$ poetry env info
Virtualenv
Python: 3.7.6
Implementation: CPython
Path: NA
System
Platform: darwin
OS: posix
Python: /usr/local/Cellar/python/3.7.6_1/Frameworks/Python.framework/Versions/3.7
Prabas-MacBook-Air:trakt-scrobbler codechilli$ poetry debug
Poetry
Version: 1.0.2
Python: 3.7.6
Virtualenv
Python: 3.7.6
Implementation: CPython
Path: NA
System
Platform: darwin
OS: posix
Python: /usr/local/Cellar/python/3.7.6_1/Frameworks/Python.framework/Versions/3.7
from trakt-scrobbler.
Hey @iamkroot , here's an update:
Installed virtualenv
& reinstalled the trakt-scrobbler. Now the log is as below;
from trakt-scrobbler.
from trakt-scrobbler.
from trakt-scrobbler.
Hmm no dice. Does your LaunchControl.app provide any additional insights? Try launchctl start com.github.iamkroot.trakt-scrobbler
from trakt-scrobbler.
Nothing happens when I do launchctl start com.github.iamkroot.trakt-scrobbler
After installing the vertualenv
, there is no error in my LaunchControl App.
When I trying to load the script, getting the same error log.
from trakt-scrobbler.
@prabapro Try loading the service first, then run the previous command. Maybe that will help
from trakt-scrobbler.
See if running /usr/local/Cellar/python/3.7.6_1/Frameworks/Python.framework/Versions/3.7/bin/python main.py
works inside /Users/codechilli/Library/trakt-scrobbler
folder.
from trakt-scrobbler.
See if running
/usr/local/Cellar/python/3.7.6_1/Frameworks/Python.framework/Versions/3.7/bin/python main.py
works inside/Users/codechilli/Library/trakt-scrobbler
folder.
@iamkroot I'm sorry, I don't know how to do this. If you don't mind, could you kindly let me know the steps to be follow please. Appreciate it.
from trakt-scrobbler.
I'm monitoring this issue, because I have the same problem on my new Ubuntu install. :)
Might be a very different issue @GMFalka. Considering this is one is mostly due to an incorrect MacOS service file. Better to create a new issue in case you're unable to fix it.
from trakt-scrobbler.
@iamkroot I'm sorry, I don't know how to do this. If you don't mind, could you kindly let me know the steps to be follow please. Appreciate it.
Sorry I should've explained better. You just need to:
cd
to/Users/codechilli/Library/trakt-scrobbler
- run
/usr/local/Cellar/python/3.7.6_1/Frameworks/Python.framework/Versions/3.7/bin/python main.py
command directly. (See scrobbler logs to confirm it works)
@iamkroot No need to say sorry mate. You are doing such an amazing job. Thank you so much for that. :)
Btw, here is what I'm getting;
from trakt-scrobbler.
@iamkroot I'm sorry, I don't know how to do this. If you don't mind, could you kindly let me know the steps to be follow please. Appreciate it.
Sorry I should've explained better. You just need to:
cd
to/Users/codechilli/Library/trakt-scrobbler
- run
/usr/local/Cellar/python/3.7.6_1/Frameworks/Python.framework/Versions/3.7/bin/python main.py
command directly. (See scrobbler logs to confirm it works)@iamkroot No need to say sorry mate. You are doing such an amazing job. Thank you so much for that. :)
@iamkroot Tried this: /usr/local/Cellar/python/3.7.6_1/Frameworks/Python.framework/Versions/3.7/bin/python3 main.py
(Used python3
instead of python
).
from trakt-scrobbler.
Aha! There we go. Looks like there's no
python
executable inside the virtualenv.
I'll push a fix for this soon. Till then, if you want to test, open up~/Library/LaunchAgents/trakt-scrobbler.plist
file and replacepython
withpython3
and save. Then load and start the service again and it should work.
@iamkroot Awesome, let me try this & come back to you asap. Thanks heaps.
from trakt-scrobbler.
Aha! There we go. Looks like there's no
python
executable inside the virtualenv.
I'll push a fix for this soon. Till then, if you want to test, open up~/Library/LaunchAgents/trakt-scrobbler.plist
file and replacepython
withpython3
and save. Then load and start the service again and it should work.
Hey @iamkroot ,
Modified the trakt-scrobbler.plist
with python3
& reboot the mac. But still getting the same error as before. Nothing is logged in /Users/codechilli/Library/Application Support/trakt-scrobbler/trakt_scrobbler.log
too.
However, when I try to run /usr/local/Cellar/python/3.7.6_1/Frameworks/Python.framework/Versions/3.7/bin/python3 main.py
inside /Users/codechilli/Library/trakt-scrobbler
folder got below response.;
And nothing logged in trakt_scrobbler.log
from trakt-scrobbler.
Hmm sorry, I jumped the gun a bit. Two things:
cd
to/Users/codechilli/Library/trakt-scrobbler
and give output ofpoetry env info -p
- Paste the contents of
~/Library/LaunchAgents/trakt-scrobbler.plist
please.
from trakt-scrobbler.
Hmm sorry, I jumped the gun a bit. Two things:
cd
to/Users/codechilli/Library/trakt-scrobbler
and give output ofpoetry env info -p
- Paste the contents of
~/Library/LaunchAgents/trakt-scrobbler.plist
please.
Hey @iamkroot , no worries. Here is the output;
Content of trakt-scrobbler.plist
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN"
"http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>Label</key>
<string>com.github.iamkroot.trakt-scrobbler</string>
<key>ProgramArguments</key>
<array>
<string>/Users/codechilli/Library/Caches/pypoetry/virtualenvs/trakt-scrobbler-SsqFgJVg-py3.7/bin/python3</string>
<string>main.py</string>
</array>
<key>WorkingDirectory</key>
<string>/Users/codechilli/Library/trakt-scrobbler</string>
<key>RunAtLoad</key>
<true />
<key>LaunchOnlyOnce</key>
<true />
<key>KeepAlive</key>
<true />
</dict>
</plist>
from trakt-scrobbler.
Could you check if
/Users/codechilli/Library/Caches/pypoetry/virtualenvs/trakt-scrobbler-SsqFgJVg-py3.7/bin/
exists and contains apython3
file? Also, try running/Users/codechilli/Library/Caches/pypoetry/virtualenvs/trakt-scrobbler-SsqFgJVg-py3.7/bin/python3 main.py
from inside/Users/codechilli/Library/trakt-scrobbler
-
Yes -
/Users/codechilli/Library/Caches/pypoetry/virtualenvs/trakt-scrobbler-SsqFgJVg-py3.7/bin/
exists. Files inside are shown below; (inside there is a shortcut forpython3
).
-
Ran
/Users/codechilli/Library/Caches/pypoetry/virtualenvs/trakt-scrobbler-SsqFgJVg-py3.7/bin/python3 main.py
inside/Users/codechilli/Library/trakt-scrobbler
folder & got below response;
from trakt-scrobbler.
Looks like the dependencies haven't been installed properly for some reason. Run the install script again (from where you downloaded the project)
from trakt-scrobbler.
![image](https://user-images.githubusercontent.com/32594937/72265903-4bc2fc80-3643-11ea-912b-3b4018c06bd3.png)
Looks like the dependencies haven't been installed properly for some reason. Run the install script again (from where you downloaded the project)
Hey @iamkroot , installed the script once again & it's still same.
Prabas-MacBook-Air:trakt-scrobbler codechilli$ poetry env info
Virtualenv
Python: 3.7.6
Implementation: CPython
Path: /Users/codechilli/Library/Caches/pypoetry/virtualenvs/trakt-scrobbler-SsqFgJVg-py3.7
Valid: True
System
Platform: darwin
OS: posix
Python: /usr/local/Cellar/python/3.7.6_1/Frameworks/Python.framework/Versions/3.7
Prabas-MacBook-Air:trakt-scrobbler codechilli$ poetry debug
Poetry
Version: 1.0.2
Python: 3.7.6
Virtualenv
Python: 3.7.6
Implementation: CPython
Path: /Users/codechilli/Library/Caches/pypoetry/virtualenvs/trakt-scrobbler-SsqFgJVg-py3.7
Valid: True
System
Platform: darwin
OS: posix
Python: /usr/local/Cellar/python/3.7.6_1/Frameworks/Python.framework/Versions/3.7
Prabas-MacBook-Air:trakt-scrobbler codechilli$ launchctl list | grep com.github.iamkroot.trakt-scrobbler
Prabas-MacBook-Air:trakt-scrobbler codechilli$ /usr/local/Cellar/python/3.7.6_1/Frameworks/Python.framework/Versions/3.7/bin/python3 main.py
Traceback (most recent call last):
File "main.py", line 10, in <module>
from player_monitors.monitor import Monitor
File "/Users/codechilli/Library/trakt-scrobbler/player_monitors/monitor.py", line 3, in <module>
import requests
ModuleNotFoundError: No module named 'requests'
Prabas-MacBook-Air:trakt-scrobbler codechilli$ poetry env info -p
/Users/codechilli/Library/Caches/pypoetry/virtualenvs/trakt-scrobbler-SsqFgJVg-py3PPrabaPraPrabPrPrabaPrabPraPraPrPrPPrPPPPPPPPPPPPPPrabas-MacBook-Air:trakt-scrobbler codechilli$
from trakt-scrobbler.
What's the output when you run poetry install
inside the installation directory (/Users/codechilli/Library/trakt-scrobbler
)?
from trakt-scrobbler.
@iamkroot Here we go;
Btw, wondering if we need to install requests
module.... Pls advice. Thanks
from trakt-scrobbler.
@prabapro try the install script now, reboot and check logs
from trakt-scrobbler.
@prabapro try the install script now, reboot and check logs
Hi @iamkroot, tried as instructed. But still same, no new entries in the log.
Response for running /Users/codechilli/Library/Caches/pypoetry/virtualenvs/trakt-scrobbler-SsqFgJVg-py3.7/bin/python3 main.py
inside /Users/codechilli/Library/trakt-scrobbler
from trakt-scrobbler.
@iamkroot sure thing :) Here's the log (For the first time, I'm seeing something in the log :)
2020-01-14 21:26:29,727 - DEBUG - MainThread - utils - /Users/codechilli/Library/Application Support/trakt-scrobbler/trakt_cache.json doesn't exist.
2020-01-14 21:26:29,727 - DEBUG - MainThread - utils - /Users/codechilli/Library/Application Support/trakt-scrobbler/trakt_token.json doesn't exist.
2020-01-14 21:26:29,727 - INFO - MainThread - trakt_interface - Access token not found in config. Initiating device authentication.
2020-01-14 21:26:30,565 - INFO - MainThread - trakt_interface - Verification URL: https://trakt.tv/activate
2020-01-14 21:26:30,565 - INFO - MainThread - trakt_interface - User Code: 49361619
2020-01-14 21:26:31,866 - DEBUG - MainThread - trakt_interface - Waiting for user to authorize the app.
2020-01-14 21:26:37,805 - DEBUG - MainThread - trakt_interface - Waiting for user to authorize the app.
2020-01-14 21:26:43,520 - DEBUG - MainThread - trakt_interface - Waiting for user to authorize the app.
2020-01-14 21:26:49,224 - DEBUG - MainThread - trakt_interface - Waiting for user to authorize the app.
2020-01-14 21:26:54,858 - DEBUG - MainThread - trakt_interface - Waiting for user to authorize the app.
2020-01-14 21:27:00,635 - DEBUG - MainThread - trakt_interface - Waiting for user to authorize the app.
2020-01-14 21:27:06,332 - DEBUG - MainThread - trakt_interface - Waiting for user to authorize the app.
2020-01-14 21:27:12,435 - INFO - MainThread - trakt_interface - Device auth successful.
2020-01-14 22:19:14,882 - DEBUG - MainThread - utils - /Users/codechilli/Library/Application Support/trakt-scrobbler/trakt_cache.json doesn't exist.
2020-01-14 22:19:14,884 - INFO - MainThread - scrobbler - Started scrobbler thread.
2020-01-14 22:19:14,884 - DEBUG - MainThread - utils - /Users/codechilli/Library/Application Support/trakt-scrobbler/watched_cache.json doesn't exist.
2020-01-14 22:19:14,892 - INFO - MainThread - monitor - Started monitor for mpv
2020-01-14 22:19:14,893 - INFO - mpv - mpv - Unable to connect to MPV. Check ipc path.
2020-01-14 22:19:14,897 - DEBUG - MainThread - utils - /Users/codechilli/Library/Application Support/trakt-scrobbler/plex_token.json doesn't exist.
2020-01-14 22:19:16,095 - ERROR - MainThread - main - Unhandled exception
Traceback (most recent call last):
File "main.py", line 78, in <module>
main()
File "main.py", line 73, in main
mon = Mon(scrobble_queue)
File "/Users/codechilli/Library/trakt-scrobbler/player_monitors/plex.py", line 45, in __init__
self.token = get_token(**plex_conf)
File "/Users/codechilli/Library/trakt-scrobbler/player_monitors/plex.py", line 32, in get_token
write_json({"token": token}, PLEX_TOKEN_PATH)
File "/Users/codechilli/Library/trakt-scrobbler/utils.py", line 36, in write_json
json.dump(data, f, indent=4)
File "/usr/local/Cellar/python/3.7.6_1/Frameworks/Python.framework/Versions/3.7/lib/python3.7/json/__init__.py", line 179, in dump
for chunk in iterable:
File "/usr/local/Cellar/python/3.7.6_1/Frameworks/Python.framework/Versions/3.7/lib/python3.7/json/encoder.py", line 431, in _iterencode
yield from _iterencode_dict(o, _current_indent_level)
File "/usr/local/Cellar/python/3.7.6_1/Frameworks/Python.framework/Versions/3.7/lib/python3.7/json/encoder.py", line 405, in _iterencode_dict
yield from chunks
File "/usr/local/Cellar/python/3.7.6_1/Frameworks/Python.framework/Versions/3.7/lib/python3.7/json/encoder.py", line 438, in _iterencode
o = _default(o)
File "/usr/local/Cellar/python/3.7.6_1/Frameworks/Python.framework/Versions/3.7/lib/python3.7/json/encoder.py", line 179, in default
raise TypeError(f'Object of type {o.__class__.__name__} '
TypeError: Object of type Response is not JSON serializable
from trakt-scrobbler.
Closed by mistake, sorry.
haha, no worries. Let me do above & come back to you in few mins. Thanks mate
from trakt-scrobbler.
Ah progress 🎊
I'm not exactly sure why you're getting that
TypeError
(seems to be working fine in my system), but we might have a solution for your installation errors.In your plist file, replace
<key>ProgramArguments</key> <array> <string>/Users/codechilli/Library/Caches/pypoetry/virtualenvs/trakt-scrobbler-SsqFgJVg-py3.7/bin/python3</string> <string>main.py</string> </array>
with
<key>ProgramArguments</key> <array> <string>poetry</string> <string>run</string> <string>python</string> <string>main.py</string> </array>
And then load the service using
launchctl
and reboot. Then check logs to see if it worked.
Hey @iamkroot, seems we are on track :)
Task 1: Modified plist file & loaded (rebooted too). below is the log;
Task 2: Tried poetry run python main.py
Scrobbler started for Plex. 👍 VLC got failed. Below is the log & vlc settings.
2020-01-14 22:32:36,834 - DEBUG - MainThread - utils - /Users/codechilli/Library/Application Support/trakt-scrobbler/trakt_cache.json doesn't exist.
2020-01-14 22:32:36,835 - INFO - MainThread - scrobbler - Started scrobbler thread.
2020-01-14 22:32:36,840 - INFO - MainThread - monitor - Started monitor for mpv
2020-01-14 22:32:36,841 - INFO - mpv - mpv - Unable to connect to MPV. Check ipc path.
2020-01-14 22:32:36,844 - WARNING - MainThread - utils - Invalid json in /Users/codechilli/Library/Application Support/trakt-scrobbler/plex_token.json.
2020-01-14 22:32:38,016 - ERROR - MainThread - main - Unhandled exception
Traceback (most recent call last):
File "main.py", line 78, in <module>
main()
File "main.py", line 73, in main
mon = Mon(scrobble_queue)
File "/Users/codechilli/Library/trakt-scrobbler/player_monitors/plex.py", line 45, in __init__
self.token = get_token(**plex_conf)
File "/Users/codechilli/Library/trakt-scrobbler/player_monitors/plex.py", line 32, in get_token
write_json({"token": token}, PLEX_TOKEN_PATH)
File "/Users/codechilli/Library/trakt-scrobbler/utils.py", line 36, in write_json
json.dump(data, f, indent=4)
File "/usr/local/Cellar/python/3.7.6_1/Frameworks/Python.framework/Versions/3.7/lib/python3.7/json/__init__.py", line 179, in dump
for chunk in iterable:
File "/usr/local/Cellar/python/3.7.6_1/Frameworks/Python.framework/Versions/3.7/lib/python3.7/json/encoder.py", line 431, in _iterencode
yield from _iterencode_dict(o, _current_indent_level)
File "/usr/local/Cellar/python/3.7.6_1/Frameworks/Python.framework/Versions/3.7/lib/python3.7/json/encoder.py", line 405, in _iterencode_dict
yield from chunks
File "/usr/local/Cellar/python/3.7.6_1/Frameworks/Python.framework/Versions/3.7/lib/python3.7/json/encoder.py", line 438, in _iterencode
o = _default(o)
File "/usr/local/Cellar/python/3.7.6_1/Frameworks/Python.framework/Versions/3.7/lib/python3.7/json/encoder.py", line 179, in default
raise TypeError(f'Object of type {o.__class__.__name__} '
TypeError: Object of type Response is not JSON serializable
2020-01-14 23:12:41,748 - DEBUG - MainThread - utils - /Users/codechilli/Library/Application Support/trakt-scrobbler/trakt_cache.json doesn't exist.
2020-01-14 23:12:41,750 - INFO - MainThread - scrobbler - Started scrobbler thread.
2020-01-14 23:12:41,759 - WARNING - MainThread - utils - Invalid json in /Users/codechilli/Library/Application Support/trakt-scrobbler/plex_token.json.
2020-01-14 23:12:43,222 - INFO - MainThread - monitor - Started monitor for plex
2020-01-14 23:12:43,232 - INFO - MainThread - monitor - Started monitor for vlc
2020-01-14 23:12:43,443 - INFO - vlc - monitor - Unable to connect to vlc. Ensure that the web interface is running.
2020-01-14 23:13:44,715 - DEBUG - scrobbler - trakt_interface - Searching cache.
2020-01-14 23:13:44,715 - DEBUG - scrobbler - trakt_interface - Searching trakt.
2020-01-14 23:14:30,928 - DEBUG - scrobbler - trakt_interface - Trakt ID: 414606
2020-01-14 23:14:30,930 - DEBUG - scrobbler - trakt_interface - {'movie': {'ids': {'trakt': 414606}}}
2020-01-14 23:15:53,031 - INFO - scrobbler - scrobbler - Scrobble start successful.
2020-01-14 23:15:55,701 - DEBUG - scrobbler - trakt_interface - Searching cache.
2020-01-14 23:15:55,701 - DEBUG - scrobbler - trakt_interface - {'movie': {'ids': {'trakt': 414606}}}
2020-01-14 23:16:13,205 - INFO - scrobbler - scrobbler - Scrobble stop successful.
2020-01-14 23:16:15,587 - DEBUG - scrobbler - trakt_interface - Searching cache.
2020-01-14 23:16:15,587 - DEBUG - scrobbler - trakt_interface - Searching trakt.
2020-01-14 23:16:44,690 - DEBUG - scrobbler - trakt_interface - Trakt ID: 413326
2020-01-14 23:16:44,691 - DEBUG - scrobbler - trakt_interface - {'movie': {'ids': {'trakt': 413326}}}
2020-01-14 23:16:59,569 - INFO - scrobbler - scrobbler - Scrobble pause successful.
2020-01-14 23:16:59,569 - DEBUG - scrobbler - trakt_interface - Searching cache.
2020-01-14 23:16:59,570 - DEBUG - scrobbler - trakt_interface - {'movie': {'ids': {'trakt': 413326}}}
2020-01-14 23:17:13,040 - INFO - scrobbler - scrobbler - Scrobble start successful.
2020-01-14 23:19:55,382 - DEBUG - scrobbler - trakt_interface - Searching cache.
2020-01-14 23:19:55,383 - DEBUG - scrobbler - trakt_interface - {'movie': {'ids': {'trakt': 413326}}}
2020-01-14 23:20:07,163 - INFO - scrobbler - scrobbler - Scrobble stop successful.
from trakt-scrobbler.
Created an Automator task as below (for both VLC & Plex);
Now, whenever I start either VLC or Plex, the scrobbler starts automatically :)
Hi! I can’t understand how to make it so that when starting the VLC the script just runs, instead of starting the service or application created in the Automator?
How do you save this code for Automator?
P.S. Sorry, if my questions seem stupid, I am poorly versed in the Automator, and even more so in programming.
from trakt-scrobbler.
I'm not exactly sure why you're getting that
TypeError
(seems to be working fine in my system), but we might have a solution for your installation errors.In your plist file, replace
<key>ProgramArguments</key> <array> <string>/Users/codechilli/Library/Caches/pypoetry/virtualenvs/trakt-scrobbler-SsqFgJVg-py3.7/bin/python3</string> <string>main.py</string> </array>
with
<key>ProgramArguments</key> <array> <string>poetry</string> <string>run</string> <string>python</string> <string>main.py</string> </array>
And then load the service using
launchctl
and reboot. Then check logs to see if it worked.
Hi @iamkroot ! I have almost the same problems as @prabapro
Service after restart not working in both versions in launchctl
, but manual poetry run python main.py
from trakt-scrobbler directory is working and VLC scrobbled.
from trakt-scrobbler.
Hi @mastaka , you're most welcome :)
I couldn't figure out the reason for your issue. See if this works: Double click on the saved file (xxxx.app
) & see if vlc opens. And then you can check the log file at /Users/mstk/Library/Application Support/trakt-scrobbler/trakt_scrobbler.log
.
from trakt-scrobbler.
@mastaka Great work with that!
from trakt-scrobbler.
@prabapro One more thing you can try, is in the plist file, replace poetry
with /usr/local/bin/poetry
and then reload the service. Maybe that might work. (Check logs to confirm)
from trakt-scrobbler.
@prabapro One more thing you can try, is in the plist file, replace
poetry
with/usr/local/bin/poetry
and then reload the service. Maybe that might work. (Check logs to confirm)
Hey @iamkroot ,
After replacing poetry
with /usr/local/bin/poetry
& loaded & rebooted, the system log is as below;
Jan 16 20:56:28 Prabas-MacBook-Air com.apple.xpc.launchd[1] (com.github.iamkroot.trakt-scrobbler): This service is defined to be constantly running and is inherently inefficient.
Jan 16 20:56:31 Prabas-MacBook-Air com.apple.xpc.launchd[1] (com.github.iamkroot.trakt-scrobbler[1351]): Service exited with abnormal code: 1
Here's the content of my trakt-scrobbler.plist
file;
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN"
"http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>Label</key>
<string>com.github.iamkroot.trakt-scrobbler</string>
<key>ProgramArguments</key>
<array>
<string>/usr/local/bin/poetry</string>
<string>run</string>
<string>python</string>
<string>main.py</string>
</array>
<key>WorkingDirectory</key>
<string>/Users/codechilli/Library/trakt-scrobbler</string>
<key>RunAtLoad</key>
<true />
<key>LaunchOnlyOnce</key>
<true />
<key>KeepAlive</key>
<true />
</dict>
</plist>
PS: @mastaka's plist file is little different from mine. Could that be a reason for this? I'm running on Catalina OS X 10.15.2
from trakt-scrobbler.
Related Issues (20)
- [Feature Request] add `scrobble_at` option to specify percentage after which trakt-scrobbler will send "watched" status to trakt HOT 2
- Cant get trakts auth working? HOT 2
- Error: Media Info is Incorrect HOT 8
- [Installation] HOT 1
- [BUG] `Ignoring encoding error 'utf-8' codec can't decode byte 0xd4 in position 38: invalid continuation byte` when playing file with russian file name HOT 6
- [Feature Request] add `send_immediately` to send "finished" status to trakt after watching >=80% to fix #202 HOT 1
- [BUG] `X-Men '97` is incorrectly recognized as "Mad Man" HOT 1
- [BUG] dots are stripped from file name leads to wrong title matched HOT 2
- VBScript is deprecated and will be removed HOT 2
- [BUG] Remap Rules not applying to Plex HOT 4
- [BUG] TypeError with Episode Range on Remap HOT 1
- [BUG] randomly getting 'All pipe instances are busy.' HOT 2
- [Installation] 'trakts init' fails HOT 1
- [BUG] Unhandled Expression "season" check log file HOT 4
- [BUG] trakt-scrobbler stops working with mpv pipes after getting 'All pipe instances are busy.' error HOT 1
- [BUG] trakts init error | malformed regex: 'https://www.youtube.com/watch?*' HOT 1
- [BUG] Sometimes trakt-scrobbler dies after not being able to connect to plex HOT 1
- [BUG] Trakts ignores remap rules and filename over ambiguous season names in path HOT 1
- [Feature Request] Sync trakt scrobbled resume point to media player HOT 1
- [BUG] trakt-scrobbler is not trying to connect to plex server after receiving 503 (`Plex Media Server is currently running startup maintenance tasks`)
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from trakt-scrobbler.