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]: Gay Adult NFO agent is unable to load existing NFO file due to incorrect search path. #256

Closed
minielim opened this issue Jun 17, 2023 · 11 comments
Labels
bug Something isn't working

Comments

@minielim
Copy link
Contributor

Describe the bug:

Gay Adult NFO agent is unable to load existing NFO file due to incorrect search path.

This appears to be due to an assumption in get_movie_name_from_folder() that the folder_path does not begin in the os path separator.

The nfo file exists as /volume1/pr0nz/Movies/(Alternadudes) - AlternaStuds (2014)/(Alternadudes) - AlternaStuds (2014).nfo

Specific Agent(s) Causing the Issue:

Gay Adult NFO

Log Attached:

2023-06-17 14:49:02,870 (7f7187e2bb38) : DEBUG (sandbox:19) - ++++++++++++++++++++++++
2023-06-17 14:49:02,871 (7f7187e2bb38) : DEBUG (sandbox:19) - Entering search function
2023-06-17 14:49:02,872 (7f7187e2bb38) : DEBUG (sandbox:19) - ++++++++++++++++++++++++
2023-06-17 14:49:02,872 (7f7187e2bb38) : INFO (init:118) - Gay Adult NFO Importer Version: 1.1-119-g5106699-225
2023-06-17 14:49:02,873 (7f7187e2bb38) : DEBUG (sandbox:19) - Plex Server Version: 1.32.3.7192-7aa441827
2023-06-17 14:49:02,873 (7f7187e2bb38) : INFO (init:123) - Agents debug logging is enabled!
2023-06-17 14:49:02,874 (7f7187e2bb38) : DEBUG (sandbox:19) - media file: /volume1/pr0nz/Movies/(Alternadudes) - AlternaStuds (2014)/(Alternadudes) - AlternaStuds (2014) Scene 1.mp4
2023-06-17 14:49:02,875 (7f7187e2bb38) : DEBUG (sandbox:19) - folder path: /volume1/pr0nz/Movies/(Alternadudes) - AlternaStuds (2014)
2023-06-17 14:49:02,875 (7f7187e2bb38) : DEBUG (sandbox:19) - Movie name from folder (with year): volume1/pr0nz/Movies/(Alternadudes) - AlternaStuds (2014)/(Alternadudes) - AlternaStuds
2023-06-17 14:49:02,876 (7f7187e2bb38) : DEBUG (sandbox:19) - Movie name from folder: volume1/pr0nz/Movies/(Alternadudes) - AlternaStuds (2014)/(Alternadudes) - AlternaStuds (2014)
2023-06-17 14:49:02,877 (7f7187e2bb38) : DEBUG (sandbox:19) - Trying /volume1/pr0nz/Movies/(Alternadudes) - AlternaStuds (2014)/nfo/(Alternadudes) - AlternaStuds (2014) Scene 1.nfo
2023-06-17 14:49:02,877 (7f7187e2bb38) : DEBUG (sandbox:19) - Trying /volume1/pr0nz/Movies/(Alternadudes) - AlternaStuds (2014)/NFO/(Alternadudes) - AlternaStuds (2014) Scene 1.nfo
2023-06-17 14:49:02,878 (7f7187e2bb38) : DEBUG (sandbox:19) - Trying /volume1/pr0nz/Movies/(Alternadudes) - AlternaStuds (2014)/(Alternadudes) - AlternaStuds (2014) Scene 1.nfo
2023-06-17 14:49:02,879 (7f7187e2bb38) : DEBUG (sandbox:19) - Trying volume1/pr0nz/Movies/(Alternadudes) - AlternaStuds (2014)/(Alternadudes) - AlternaStuds.nfo
2023-06-17 14:49:02,879 (7f7187e2bb38) : DEBUG (sandbox:19) - Trying volume1/pr0nz/Movies/(Alternadudes) - AlternaStuds (2014)/(Alternadudes) - AlternaStuds (2014).nfo
2023-06-17 14:49:02,880 (7f7187e2bb38) : DEBUG (sandbox:19) - Trying /volume1/pr0nz/Movies/(Alternadudes) - AlternaStuds (2014)/video_ts.nfo
2023-06-17 14:49:02,880 (7f7187e2bb38) : DEBUG (sandbox:19) - Trying /volume1/pr0nz/Movies/(Alternadudes) - AlternaStuds (2014)/movie.nfo
2023-06-17 14:49:02,881 (7f7187e2bb38) : INFO (init:1160) - No .nfo file found! Aborting!

@minielim minielim added the bug Something isn't working label Jun 17, 2023
@JPH71
Copy link

JPH71 commented Jun 18, 2023 via email

@CodyBerenson
Copy link
Owner

@JPH71 He is referring to GAnfoMoviesImporter.bundle that is part of our repository. Not one of the agents that you created, its a widely distributed "catch-all" agent in which Plex consumes the metadata in a properly formatted NFO files that are matched to a similarly named movie in a folder. Requires the use also of the local assets agent.

@minielim would you upload your .NFO and I'll take a look and do some testing? Have you been successful with other .NFOs with other titles? I just tested a .NFO and it worked fine, so it would be really helpful to see your .NFO. Since we didn't create the agent, I'm not sure how much support we can offer for the agent....

@minielim
Copy link
Contributor Author

The NFO files are xml documents which provide information in a format mostly from xbmc. I had been successfully using them in cases where the other scrapers aren't picking up things as expected. (In this case, the IAFD scraper doesn't seem to support stacked movies.)

If I apply this quick-and-dirty test change:

diff --git a/GAnfoMoviesImporter.bundle/Contents/Code/__init__.py b/GAnfoMoviesImporter.bundle/Contents/Code/__init__.py
index 5e2ddc5..2c916d6 100644
--- a/GAnfoMoviesImporter.bundle/Contents/Code/__init__.py
+++ b/GAnfoMoviesImporter.bundle/Contents/Code/__init__.py
@@ -1108,6 +1108,21 @@ def get_related_files(video_file, file_extension):
 MOVIE_NAME_REGEX = re.compile(r' \(.*\)')


+def splitall(path):
+    allparts = []
+    while 1:
+        parts = os.path.split(path)
+        if parts[0] == path:  # sentinel for absolute paths
+            allparts.insert(0, parts[0])
+            break
+        elif parts[1] == path: # sentinel for relative paths
+            allparts.insert(0, parts[1])
+            break
+        else:
+            path = parts[0]
+            allparts.insert(0, parts[1])
+    return allparts
+
 def get_movie_name_from_folder(folder_path, with_year):
     """
     Get the name of the movie from the folder.
@@ -1117,7 +1132,7 @@ def get_movie_name_from_folder(folder_path, with_year):
     :return:
     """
     # Split the folder into a list of paths
-    folder_split = os.path.normpath(folder_path).split(os.sep)
+    folder_split = splitall(os.path.normpath(folder_path))

     if folder_split[-1] == 'VIDEO_TS':  # If the folder is from a DVD
         # Strip the VIDEO_TS folder

Instead of being unable to find the nfo file and begin the scraping process, it instead proceeds as expected:

2023-06-17 15:48:39,021 (7f05da27ab38) :  DEBUG (sandbox:19) - ++++++++++++++++++++++++
2023-06-17 15:48:39,022 (7f05da27ab38) :  DEBUG (sandbox:19) - Entering search function
2023-06-17 15:48:39,022 (7f05da27ab38) :  DEBUG (sandbox:19) - ++++++++++++++++++++++++
2023-06-17 15:48:39,023 (7f05da27ab38) :  INFO (__init__:118) - Gay Adult NFO Importer Version: 1.1-119-g5106699-225
2023-06-17 15:48:39,023 (7f05da27ab38) :  DEBUG (sandbox:19) - Plex Server Version: 1.32.3.7192-7aa441827
2023-06-17 15:48:39,024 (7f05da27ab38) :  INFO (__init__:123) - Agents debug logging is enabled!
2023-06-17 15:48:39,025 (7f05da27ab38) :  DEBUG (sandbox:19) - media file: /volume1/pr0nz/Movies/(Alternadudes) - AlternaStuds (2014)/(Alternadudes) - AlternaStuds (2014) Scene 1.mp4
2023-06-17 15:48:39,025 (7f05da27ab38) :  DEBUG (sandbox:19) - folder path: /volume1/pr0nz/Movies/(Alternadudes) - AlternaStuds (2014)
2023-06-17 15:48:39,026 (7f05da27ab38) :  DEBUG (sandbox:19) - Movie name from folder (with year): /volume1/pr0nz/Movies/(Alternadudes) - AlternaStuds (2014)/(Alternadudes) - AlternaStuds
2023-06-17 15:48:39,027 (7f05da27ab38) :  DEBUG (sandbox:19) - Movie name from folder: /volume1/pr0nz/Movies/(Alternadudes) - AlternaStuds (2014)/(Alternadudes) - AlternaStuds (2014)
2023-06-17 15:48:39,027 (7f05da27ab38) :  DEBUG (sandbox:19) - Trying /volume1/pr0nz/Movies/(Alternadudes) - AlternaStuds (2014)/nfo/(Alternadudes) - AlternaStuds (2014) Scene 1.nfo
2023-06-17 15:48:39,028 (7f05da27ab38) :  DEBUG (sandbox:19) - Trying /volume1/pr0nz/Movies/(Alternadudes) - AlternaStuds (2014)/NFO/(Alternadudes) - AlternaStuds (2014) Scene 1.nfo
2023-06-17 15:48:39,029 (7f05da27ab38) :  DEBUG (sandbox:19) - Trying /volume1/pr0nz/Movies/(Alternadudes) - AlternaStuds (2014)/(Alternadudes) - AlternaStuds (2014) Scene 1.nfo
2023-06-17 15:48:39,029 (7f05da27ab38) :  DEBUG (sandbox:19) - Trying /volume1/pr0nz/Movies/(Alternadudes) - AlternaStuds (2014)/(Alternadudes) - AlternaStuds.nfo
2023-06-17 15:48:39,030 (7f05da27ab38) :  DEBUG (sandbox:19) - Trying /volume1/pr0nz/Movies/(Alternadudes) - AlternaStuds (2014)/(Alternadudes) - AlternaStuds (2014).nfo
2023-06-17 15:48:39,030 (7f05da27ab38) :  INFO (__init__:1170) - Found .nfo file /volume1/pr0nz/Movies/(Alternadudes) - AlternaStuds (2014)/(Alternadudes) - AlternaStuds (2014).nfo

Note the /volume1/ vs volume1/ in several of those filenames.

Attached is the nfo file (but as a txt file since NFO isn't an allowed file type) (Alternadudes) - AlternaStuds (2014).txt

@CodyBerenson
Copy link
Owner

@minielim Sounds like you found a fix. Your NFO works perfectly for me with the as-in agent, but I'm going to admit I'm not a coder and it isn't clear to me what your use case and folder structure/file naming looks like given your mention of stacking. If you'd like to propose a pull request, we can get your fix for this agent incorporated into the repository once I've tested it a bit. And I've asked Jason to add to his considerable backlog dealing with the IAFD cloudflare stuff in this agent so the IAFD portions may again work. IAFD is messy across the board right now, and Jason is trying to figure out a solution that will work across all agents.

Long on my to-do list was to craft some documentation in our guide for folks on how to use the agent to index a film that doesn't appear on any sites, paired with a poster and a properly formatted .NFO. Question: what tool do you use to build your .NFO? I use a an old java scraper that doesn't scrape anymore but will build a .NFO...but I can see at least one additional field in your .NFO that isn't an option with the tool I use.

Finally, I'll test out IAFD stacking, thanks for mentioning. I believe it supports the same stacking cadence as the rest of the agents, but I'll take a look.

Cheers!

@CodyBerenson
Copy link
Owner

CodyBerenson commented Jun 18, 2023

Just tested IAFD Stacking, worked fine on my system:

image

image
image

@JPH71
Copy link

JPH71 commented Jun 18, 2023 via email

@minielim
Copy link
Contributor Author

Why this issue doesn't show up on Windows

This issue is only going to appear on Linux and from your example you are on Windows.
On Windows the path Y:\test\AlternaStuds\<whatever> will be split into [ "Y:", "test", "AlternaStuds", ... ]. This list can easily be turned back into a valid path by putting a folder separator between the entries.

However, on Linux the path starts with the folder separator (instead of a drive letter). So, the path /volume1/pr0nz/Movies/AlternaStuds/<whatever> will be split into [ "volume1", "pr0nz", ... ] which no longer results in a valid path when joined back together with folder separators.

I will see about creating a pull request with my fix.

NFO file creation

From an experiment in the distant past with XBMC/Kodi, I have some NFO files generated by, I think, Ember Media Manager which gave me the general xml format. I then looked through the agent python to see what tags it was looking for and experimented a bit.

These days, I find the minimum information required and then open up a text editor and write the XML manually. So, not the most helpful to anyone else.

From the Ember Media Manager forum, it does look like someone is working on an adult scraper, but I have not tried it.

My library folder layout

    /volume1/pr0nz/Movies/ - library with the Gay Adult Films agent enabled
        (Studio) - Title (Year)/
            (Studio) - Title (Year).<video extension> - movie in a single file
            (Studio) - Title (Year)-<Extra_type>.<video extension> - behindthescenes, trailer, other, etc.  for extra videos related to this title
            OR
            (Studio) - Title (Year) Scene <N>.<video extension> - scene format from pdf documentation (images/PlexGayMetadataAgents-InstallationandUsageGuide.pdf page 30)

I had been following the pdf documentation which lists the Scene format as (Studio) - Title (Year) Scene <N>.<video extension> which ends up with the IAFD agent failing in a search for:

2023-06-18 13:45:09,447 (7f1fe56f0b38) :  INFO (sandbox:19) - IAFD  - SEARCH:: *********************************************** >> IAFD: Finished Search Routine << ***********************************************
2023-06-18 13:45:09,448 (7f1fe56f0b38) :  INFO (sandbox:19) - IAFD  - SEARCH:: ************************************** >> (Alternadudes) - AlternaStuds (2014) Scene 1 (0) << *************************************

Switching to your example format (Studio) - Title (Year) - Scene <N>.<video extension> does result in a much more promising:

2023-06-18 13:45:09,447 (7f1fe56f0b38) :  INFO (sandbox:19) - IAFD  - SEARCH:: *********************************************** >> IAFD: Finished Search Routine << ***********************************************
2023-06-18 13:49:02,365 (7f1fe56f0b38) :  INFO (sandbox:19) - IAFD  - SEARCH:: ******************************************** >> (Alternadudes) - AlternaStuds (2014) << *******************************************

However, the scraper gets a 403 and stops the search processing so I can't currently validate further.

It appears the IAFD scraper probably does support scenes and I just had the filename formatting wrong. Thanks for the working example.

@JPH71
Copy link

JPH71 commented Jun 18, 2023 via email

@JPH71
Copy link

JPH71 commented Jun 18, 2023 via email

@minielim
Copy link
Contributor Author

Using the scene formatting from the pdf doc (Studio) - Title (Year) Scene <N>.<video extension> I got the error:
com.plexapp.agents.IAFD.log.docsFormat.txt

I did also test (Studio) - Title (Year)-Scene <N>.<video extension> and it also failed to build a correct search string in the exact same way.

Given the working example earlier in this thread, I have updated my formatting to (Studio) - Title (Year) - Scene <N>.<video extension> which now appears to do a valid search but is thwarted by the HTTP 403:
com.plexapp.agents.IAFD.log.exampleFormat.txt

@CodyBerenson
Copy link
Owner

@minielim I tested a bunch of .NFO titles, Pull request merged. Thanks for the contribution. I'm going to close this issue.

re: Adult .NFO scrapers, there are two options that I know of for Gay Porn Feature Films. TinyMediaManager allows one to use TMDB to find some titles, and MediaElch also uses TMDB but also AEBN, HotMovies, and DVDEmpire (although gay content is only scraped via AEBN).

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

No branches or pull requests

3 participants