ZeroQI / Hama.bundle

Plex HTTP Anidb Metadata Agent (HAMA)
GNU General Public License v3.0
1.21k stars 114 forks source link

Beta Agent "Permission" issue #214

Closed JathTyki closed 6 years ago

JathTyki commented 6 years ago

Hello,

I'm experiencing the below issue even after doing a chmod -R 775 on the Plex Media Server folder required, and even after creating the log file that it says is missing.

I did include some errors that it's pushing out anyways, in case you wanted to see it.

2018-06-13 19:20:17,512 (80ec27400) : INFO (common:116) - ------------------------------------------------------------------------------------------------------------------------------------------------------------- 2018-06-13 19:20:17,512 (80ec27400) : INFO (common:117) - common.PlexLog(file="", movie=False) 2018-06-13 19:20:17,512 (80ec27400) : INFO (common:119) - [!] file: "/media/Anime/Kimi no Na wa/Kimi no Na Wa.mkv" 2018-06-13 19:20:17,512 (80ec27400) : INFO (common:81) - [!] Library access denied 2018-06-13 19:20:17,512 (80ec27400) : INFO (common:92) - [!] ASS root scanner file missing: "/var/db/plexdata/Plex Media Server/Plug-in Support/Data/com.plexapp.agents.hama/DataItems/_Logs/_root_.scanner.log" 2018-06-13 19:20:17,513 (80ec27400) : INFO (common:128) - [ ] library: "" 2018-06-13 19:20:17,513 (80ec27400) : INFO (common:129) - [ ] root: "/media/Anime/Kimi no Na wa" 2018-06-13 19:20:17,513 (80ec27400) : INFO (common:130) - [ ] path: "" 2018-06-13 19:20:17,513 (80ec27400) : INFO (common:131) - [ ] Plex root: "/var/db/plexdata/Plex Media Server" 2018-06-13 19:20:17,513 (80ec27400) : INFO (common:132) - [ ] Log folder: "Plug-in Support/Data/com.plexapp.agents.hama/DataItems/_Logs" 2018-06-13 19:20:17,513 (80ec27400) : INFO (common:136) - [ ] Log file: "_root_.agent-update.log" 2018-06-13 19:20:17,514 (80ec27400) : INFO (common:137) - [ ] mode: "w" 2018-06-13 19:20:17,514 (80ec27400) : CRITICAL (agentkit:1078) - Exception in the update function of agent named 'HamaTV', called with guid 'com.plexapp.agents.hama://anidb-11829?lang=en' (most recent call last): File "/usr/pbi/plexmediaserver-amd64/share/plexmediaserver/Resources/Plug-ins-29f6d1796/Framework.bundle/Contents/Resources/Versions/2/Python/Framework/api/agentkit.py", line 1076, in _update agent.update(obj, media, lang, **kwargs) File "/var/db/plexdata/Plex Media Server/Plug-ins/Hama.bundle/Contents/Code/__init__.py", line 131, in update def update (self, metadata, media, lang, force ): Update (metadata, media, lang, force, False) File "/var/db/plexdata/Plex Media Server/Plug-ins/Hama.bundle/Contents/Code/__init__.py", line 100, in Update log = common.PlexLog(media=media, movie=movie, search=False) File "/var/db/plexdata/Plex Media Server/Plug-ins/Hama.bundle/Contents/Code/common.py", line 148, in __init__ except IOError, e: self.error('updateLoggingConfig: failed to set logfile: %s', str(e)) File "/var/db/plexdata/Plex Media Server/Plug-ins/Hama.bundle/Contents/Code/common.py", line 153, in error def error (self, msg, *args, **kwargs): (Log.Error if self.isAgent else logging.error ) (msg, *args, **kwargs) AttributeError: 'PlexLog' object has no attribute 'isAgent'

ZeroQI commented 6 years ago

I can see you use Hama Beta branch but it cannot see the root log created by the ASS scanner: /var/db/plexdata/Plex Media Server/Plug-in Support/Data/com.plexapp.agents.hama/DataItems/_Logs/root.scanner.log shouldn't caue a crash though Here it complains about a PlexLog.isAgent call so related to Logging in common.py file line 153.

I need you to:

With that i can reproduce the series in my library and try to reproduce the issue to be able to solve it

JathTyki commented 6 years ago

confirm you are using Absolute series scanner - Yes I am confirm if it is a movie or series library - Series library refresh manually the metadata of that movie/serie - Attempted, no go. attach hama log - Don't know how to attach so I hosted here. http://www.mediafire.com/file/ke978v9o4s4q2by/com.plexapp.agents.hama.log confirm path: root "/media/Anime" and file "Kimi no Na wa/Kimi no Na Wa.mkv" in a movie library? - This is correct.

JathTyki commented 6 years ago

As a note by the way, I moved over to the beta agent because even the master agent was experiencing issues with this series. Had some issues downloading a couple other series metadata also, but other series it was fine. Had hoped maybe the beta would help. Lol.

ZeroQI commented 6 years ago

I know you have an error scanning this movie (your name with japanese title) and another error while managing the exception so i cannot solve directly. Please update to latest code and attach logs again

i looked at the part with the original error but no clue what could be wrong:

      log = logging.getLogger(name)                                      # update root logging's handler
      for handler in log.handlers:  log.removeHandler(handler)      # remove all old handlers
      handler = logging.handlers.RotatingFileHandler(file, mode=mode or 'w', maxBytes=maxBytes, backupCount=backupCount, encoding=encoding, delay=delay)
      handler.setFormatter(logging.Formatter(log_format))            # Set log format
      log.addHandler(handler)

If you did solve please tell me how

JathTyki commented 6 years ago

Well, I thought it was part of my stupidity because I forgot that it was an Anime Movie, and I was scanning it with the TV Show scanner part of Hama. So I thought scanning it with the movie one would fix it. Nope.

I created a new Library as "Anime Movies", moved the movie to the folder and tried scanning it. Nothing. I tried searching via the Japanese name and the English name but it continued to give a search exception error. I attached the log.

The interesting thing is that in my regular Anime folder, some anime's aren't getting the pictures and all downloaded for the series, like ReLIFE and GoSick didn't show up with pictures. Though the log doesn't say anything about those series. This is also with both the HamaTV scanner and the regular Plex Series Scanner. So not sure what's happening there. com.plexapp.agents.hama.log

JathTyki commented 6 years ago

Okay so in reference to this, it seems like the common.py fix caused it to start downloading some metadata. It actually does download items now which is a big plus. The main thing is it's not downloading posters or anything of the sort like that. Here is the new log. I feel like this is something similar to the TV Series issue too where the posters aren't being downloaded for some reason, using both scanners. Not sure what's happening with it.

com.plexapp.agents.hama.log

ZeroQI commented 6 years ago

Anime movies names the same as the folder are regonised by the scanner and agent Pleasse use my scanner if there is no noticable difference as HAMA relies on scanner logs to find the series root folder

Do you have series logs in /var/db/plexdata/Plex Media Server/Plug-in Support/Data/com.plexapp.agents.hama/DataItems/_Logs ?

It look like the agent doesn't have permission to write in this folder, but at least the exception is caught so it doesn't stop the agent...

Please check there is 2 distinct files refused creation rights...:

updateLoggingConfig: failed to set logfile: [Errno 13] Permission denied: '/var/db/plexdata/Plex Media Server/Plug-in Support/Data/com.plexapp.agents.hama/DataItems/_Logs/_unknown_folder.agent-search.log'

[Errno 13] Permission denied: '/var/db/plexdata/Plex Media Server/Plug-in Support/Data/com.plexapp.agents.hama/DataItems/AniDB/xml
JathTyki commented 6 years ago

Okay so, running some tests for this, here's the results.

The root.scanner.log file in _Logs only has this line: Place Plex token string in file in Plex root '.../Plex Media Server/X-Plex-Token.id' to have a log per library - https://support.plex.tv/hc/en-us/articles/204059436-Finding-your-account-token-X-Plex-Token

I tried remediating it and it didn't work. Not sure what I'm doing wrong there.

The log file - attached below - has made progress but now I'm stuck on my permissions somehow. Even after giving chmod -R 775 to DataItems\MyAnimeList\xml, it keeps failing saying it doesn't have permissions. Annoying me, frankly. com.plexapp.agents.hama.log

ZeroQI commented 6 years ago

that's for hama to create a subfolder in logs with library name that's ok you don't need it For the rights, i cannot help much.

IOError: [Errno 13] Permission denied: '/var/db/plexdata/Plex Media Server/Plug-in Support/Data/com.plexapp.agents.hama/DataItems/MyAnimeList/xml/._32281.xml'

You have a right issue you need all rights for subfolders to create files

JathTyki commented 6 years ago

Yep, I got the rights issue resolved. Strange.

Now the only issue I'm having is it's still not downloading posters for some series, and it's not even showing that I'm scanning metadata for them in the logs.

For example, I do "Refresh metadata" for Gosick, and it doesn't show in the hama.log at all.

ZeroQI commented 6 years ago

Can you tell me how you fixed it? i want to include it in the read-me... if you give me the scanner file list for it (in agent data folders logs) i can reproduce the behaviour on my PC and investigate...

JathTyki commented 6 years ago

I had to specifically grant the DataItems folder 777 permissions by doing chmod -R 777 DataItems/. With the forward slash. Doing it without wouldn't have it work.

If you mean the logs in DataItems/_Logs, there's no data really in there. Unknown folder log doesn't give anything and the root scanner complains about a token that I already placed in proper place and it still fails.

ZeroQI commented 6 years ago

if you create a text file with the relative path to the library root and filenames for 1 impacted serie at least, i will reproduce your library and fix any issue i can see

JathTyki commented 6 years ago

All of my files in FreeNAS jail are stored in something like "/media/Anime/Gosick/Gosick - 01.mkv" with the Plex install being /var/db/plexdata/Plex Media Server/.....

If you need more than that, let me know.

ZeroQI commented 6 years ago

I just merged beta branch into master branch I suppose your library root folder is "/media/Anime"? if so i reproduced the naming but not the issue... Could you paste the agent logs again so i can check issues remaining, please?

JathTyki commented 6 years ago

I gotta say, I have NO IDEA what happened within the past 12 hours. I attempted just to see what happened all weekend refreshing the metadata of the series that had issues, wouldn't work. This morning, they're all fixed. I don't know if it was a matter of connectivity issues to something or maybe the DB it was pulling from was having some issues, but it's all better now.

-Shrugs- I really have no idea on this one what fixed it. FM.

ZeroQI commented 6 years ago

That's ok, Plex weird issues happen, especially after batches of bad agent codes i noticed... Sven7 also had a weird error, ok after reboot. Sorry for the miscommunication at the beginning, but thatnks to your report, the agent is better and accurate for AniDB now, which will greatly help many users not using english titles (some of which atre truelly atrociously bad...). Closing that case.