Atelier-Shiori / malupdaterosx-cocoa

Native MyAnimeList Scrobbler for macOS
https://malupdaterosx.moe/malupdaterosx/
BSD 3-Clause "New" or "Revised" License
24 stars 3 forks source link

Crunchyroll will not scrobble. #29

Closed lxcalghost closed 7 years ago

lxcalghost commented 7 years ago

MacOS Sierra Version 10.12.4 Safari 10.1 Javascript from Apple Events = enabled

I start watching a show on Crunchyroll but no update is triggered on the updater, all I see is "idle" on the status. I have tested anime in MPV just to make sure everything is working and that seems to work fine. Any help would be appreciated.

(I have also tried Plex Web and have the same issue there too.)

moyitpro commented 7 years ago

It would help if you provided the URL for the crunchyroll stream that does not work. Also running the detectstream app and copying the output will help. You can do this by right clicking the application and view contents. This application is in the resources folder.

As for Plex web, you must set the Plex Agent to personal media, otherwise it wont work

lxcalghost commented 7 years ago

http://www.crunchyroll.com/miss-kobayashis-dragon-maid/episode-1-the-strongest-maid-in-history-tohru-well-she-is-a-dragon-728801

$ /Applications/MAL\ Updater\ OS\ X.app/Contents/Resources/detectstream ; exit;
2017-04-03 05:13:37.391 detectstream[1474:83486] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '*** -[NSRegularExpression enumerateMatchesInString:options:range:usingBlock:]: nil argument'
*** First throw call stack:
(
    0   CoreFoundation                      0x00007fff9970437b __exceptionPreprocess + 171
    1   libobjc.A.dylib                     0x00007fffae4f848d objc_exception_throw + 48
    2   CoreFoundation                      0x00007fff99782c3d +[NSException raise:format:] + 205
    3   Foundation                          0x00007fff9b0912cb -[NSRegularExpression(NSMatching) enumerateMatchesInString:options:range:usingBlock:] + 234
    4   Foundation                          0x00007fff9b0def26 -[NSRegularExpression(NSMatching) firstMatchInString:options:range:] + 156
    5   detectstream                        0x000000010ede098c -[ezregex findMatch:pattern:rangeatindex:] + 131
    6   detectstream                        0x000000010ede04c0 -[BrowserDetection checkURL:] + 98
    7   detectstream                        0x000000010eddf0aa +[BrowserDetection getPages] + 676
    8   detectstream                        0x000000010ede0579 main + 64
    9   libdyld.dylib                       0x00007fffaeddd235 start + 1
)
libc++abi.dylib: terminating with uncaught exception of type NSException
Abort trap: 6
logout
Saving session...
...copying shared history...
...saving history...truncating history files...
...completed.

[Process completed]

I guess it's terminating and not detecting the stream?

moyitpro commented 7 years ago

I haven't figured out why the crash happens, but it happens since sometimes Safari does not return the title and URL, causing a nil object to be passed which cause it to crash. MAL Updater will ignore the output if detectstream crashes.

The way to fix it is to restart your browser. It should detect normally

lxcalghost commented 7 years ago

Oh that's pretty unfortunate. I've restarted my browser 3-4 times in the process but doesn't seem to have picked up the title/url a single time. Are there any particular requirements for the app to run?

moyitpro commented 7 years ago

There is no special requirements, but you can try Chrome and see if you experience the same issues. If not, I'll look into it.

Also, seems to be working in my end.

Mac-Pro:~ tedezarize$ /Applications/MAL\ Updater\ OS\ X.app/Contents/Resources/detectstream ; exit; {"result":[{"browser":"Safari","title":"Miss Kobayashi's Dragon Maid","season":1,"site":"crunchyroll","episode":1}]} logout Saving session... ...copying shared history... ...saving history...truncating history files... ...completed. Deleting expired sessions...154 completed.

lxcalghost commented 7 years ago

I thought it might be Xcode, I went and reinstalled it and then restarted my browsers and now it seems to work on both of them. Not sure what the issue was but seems to be fixed.

Thanks for the help. Also for the app in general, I'll make a donation soon.

moyitpro commented 7 years ago

Regarding the crash, I added a fail safe so it will just skip that tab and keep checking instead of crashing, even though it might result in nothing being brought back.

https://github.com/Atelier-Shiori/detectstream/commit/b430d2ef69608346f1f47198b56f33d8cf4f2a85

But it's strange how it always happens to Safari. Not surprising since the scripting bridge is not perfect.