Skip to content
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

[BUG] launchctl errors in start/stop commands on MacOS #83

Closed
haykkh opened this issue Sep 22, 2020 · 7 comments · Fixed by #154
Closed

[BUG] launchctl errors in start/stop commands on MacOS #83

haykkh opened this issue Sep 22, 2020 · 7 comments · Fixed by #154
Labels
bug Something isn't working help wanted Extra attention is needed

Comments

@haykkh
Copy link

haykkh commented Sep 22, 2020

Describe the bug
1.1.0 doesn't seem to be working. I first upgraded from 1.0.0 using

  1. Stop the app using trakts stop
  2. Run pipx upgrade trakt-scrobbler
  3. Start the app again using trakts start

But trakts start gives

$ trakts start
[CalledProcessError]
Command '['launchctl', 'start', 'com.iamkroot.trakt-scrobbler']' returned non-zero exit status 3.

trakts status:

$ trakts status
Could not find service "com.iamkroot.trakt-scrobbler" in domain for

[CalledProcessError]
Command '['launchctl', 'list', 'com.iamkroot.trakt-scrobbler']' returned non-zero exit status 113.

trakts -V:

$ trakts -V
Trakts version 1.0.0

According to pipx list:

$ pipx list
venvs are in /Users/me/.local/pipx/venvs
apps are exposed on your $PATH at /Users/me/.local/bin
   package trakt-scrobbler 1.1.0, Python 3.8.5
    - trakts

I have tried pipx reinstall-all / pipx uninstall + pipx install as well.

Running trakts autostart enable seems to have made it run, but it's still printing out 1.0.0 for -V and giving me the same errors as #82 when trying to clear backlogs.

Desktop (please complete the following information):

  • OS: macOS
  • Python Version: 3.8.5
  • Player: Plex
  • Player Version: 4.29.2

Log file
Log entries since update:

Click to see log contents

2020-09-22 16:58:38,666 - DEBUG - MainThread - backlog_cleaner - Adding item to history {'state': 2, 'progress': 99.71, 'media_info': {'type': 'episode', 'title': 'The X-Files', 'season': '1', 'episode': 1}, 'updated_at': 1600518114.526402}
2020-09-22 16:58:39,293 - DEBUG - MainThread - backlog_cleaner - Adding item to history {'state': 2, 'progress': 95.65, 'media_info': {'type': 'episode', 'title': 'The Spy', 'season': '1', 'episode': 3}, 'updated_at': 1600539429.3437939}
2020-09-22 16:58:39,722 - DEBUG - MainThread - backlog_cleaner - Adding item to history {'state': 2, 'progress': 95.69, 'media_info': {'type': 'episode', 'title': 'The Spy', 'season': '1', 'episode': 4}, 'updated_at': 1600542651.411433}
2020-09-22 16:58:41,184 - DEBUG - MainThread - backlog_cleaner - Adding item to history {'state': 2, 'progress': 95.45, 'media_info': {'type': 'episode', 'title': 'The Spy', 'season': '1', 'episode': 5}, 'updated_at': 1600547718.157074}
2020-09-22 16:58:41,852 - DEBUG - MainThread - backlog_cleaner - Adding item to history {'state': 2, 'progress': 96.17, 'media_info': {'type': 'episode', 'title': 'The Spy', 'season': '1', 'episode': 6}, 'updated_at': 1600619220.821142}
2020-09-22 16:58:42,775 - INFO - MainThread - scrobbler - Started scrobbler thread.
2020-09-22 16:58:42,782 - INFO - MainThread - monitor - Started monitor for plex
2020-09-22 16:58:42,788 - DEBUG - scrobbler - scrobbler - Scrobbling pause at 78.19% for The X-Files
2020-09-22 16:58:43,278 - INFO - scrobbler - scrobbler - Scrobble pause successful for The X-Files S01E02
2020-09-22 16:58:44,614 - DEBUG - scrobbler - backlog_cleaner - Adding item to history {'state': 2, 'progress': 99.71, 'media_info': {'type': 'episode', 'title': 'The X-Files', 'season': '1', 'episode': 1}, 'updated_at': 1600518114.526402}
2020-09-22 16:58:45,334 - DEBUG - scrobbler - backlog_cleaner - Adding item to history {'state': 2, 'progress': 95.65, 'media_info': {'type': 'episode', 'title': 'The Spy', 'season': '1', 'episode': 3}, 'updated_at': 1600539429.3437939}
2020-09-22 16:58:45,807 - DEBUG - scrobbler - backlog_cleaner - Adding item to history {'state': 2, 'progress': 95.69, 'media_info': {'type': 'episode', 'title': 'The Spy', 'season': '1', 'episode': 4}, 'updated_at': 1600542651.411433}
2020-09-22 16:58:46,460 - DEBUG - scrobbler - backlog_cleaner - Adding item to history {'state': 2, 'progress': 95.45, 'media_info': {'type': 'episode', 'title': 'The Spy', 'season': '1', 'episode': 5}, 'updated_at': 1600547718.157074}
2020-09-22 16:58:49,225 - DEBUG - scrobbler - backlog_cleaner - Adding item to history {'state': 2, 'progress': 96.17, 'media_info': {'type': 'episode', 'title': 'The Spy', 'season': '1', 'episode': 6}, 'updated_at': 1600619220.821142}

@iamkroot
Copy link
Owner

iamkroot commented Sep 22, 2020

it's still printing out 1.0.0 for -V

That's my mistake. Forgot to update the value at one place!

same errors as #82 when trying to clear backlogs

Yeah, you'll have to manually edit watched_backlog.json file and remove the quotes, making "1" as 1 for all the season fields. Sorry for not clarifying this 😅 It'll work as expected in the future.

@iamkroot
Copy link
Owner

Although, I'm not sure why trakts start is failing after the update. Does it work after running autostart enable?

@haykkh
Copy link
Author

haykkh commented Sep 22, 2020

Thanks again!

$ trakts start
The scrobbler is running
Monitored players: plex
Last successful scrobble: Pause Raised by Wolves S01E04, at Tue Sep 22 17:48:56 2020

@iamkroot
Copy link
Owner

Hmm weird indeed. I don't have access to a Mac so I can only guess the expected behaviour. We'll explore the bug if it happens again some time later.

@listy-bit
Copy link

Hi, this has happened to me, but not after an update. It happened on the 11th, but I've only just noticed. I updated to latest version, but the issue was still present. Resolved by using autostart enable. Backlog was empty though, just [].

MacOS
Python 3.8.5
Plex 1.20.4.3517
trakts 1.1.2 / 1.1.3

@iamkroot iamkroot changed the title [BUG] Error while updating/installing 1.1.0 [BUG] launchctl errors in start/stop commands Nov 21, 2020
@iamkroot iamkroot reopened this Nov 21, 2020
@iamkroot iamkroot added bug Something isn't working help wanted Extra attention is needed labels Nov 21, 2020
@iamkroot iamkroot changed the title [BUG] launchctl errors in start/stop commands [BUG] launchctl errors in start/stop commands on MacOS Nov 21, 2020
@iamkroot
Copy link
Owner

This is mostly unrelated to the backlog cleaner, and has to do with the launchctl service manager on MacOS. Since I don't have access to a Mac, the current implementation is only based on what I could find on the net, and a few helpful users who tested some parts of it. I'd prefer if someone would take a proper look at getting to the root cause of this.

@Aerozolic
Copy link

Aerozolic commented Jan 6, 2021

Yup, same problem here. macOS 10.15.7.
trakts status
Could not find service "com.iamkroot.trakt-scrobbler" in domain for port

[CalledProcessError]
Command '['launchctl', 'list', 'com.iamkroot.trakt-scrobbler']' returned non-zero exit status 113.

After restart I get:
trakts status
The scrobbler is running
Monitored players: vlc

But it doesn't work. And after manually stopping the service I'm unable to start it up again. Last successful scrobble was on the 31st.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working help wanted Extra attention is needed
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants