javinizer / Javinizer

(NSFW) Organize your local Japanese Adult Video (JAV) library
MIT License
591 stars 61 forks source link

Downloading cover image from r18 failing randomly on some title #83

Closed damenootoko closed 4 years ago

damenootoko commented 4 years ago

Expected Behavior

javinizer -apply command completed succesfully

Current Behavior

fails with an error WARNING: [2020-09-11T11:07:47][Set-JavMovie] Error downloading cover images Exception: C:\Users\Funster\Documents\PowerShell\Modules\Javinizer\1.7.3\Private\Set-JavMovie.ps1:113 Line | 113 | … $webClient.DownloadFile(($DataObject.CoverUrl).ToString() … | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | Exception calling "DownloadFile" with "2" argument(s): "A connection attempt failed because the | connected party did not properly respond after a period of time, or established connection failed | because connected host has failed to respond. A connection attempt failed because the connected party | did not properly respond after a period of time, or established connection failed because connected | host has failed to respond."

the cover url does exist and echoed in the script, and when i go to download it manually, rename it to fanart.jpg, and rerun apply it completes successfully (even downloading the much larger trailer file)

Steps to Reproduce (for bugs)

run javinizer on some title, (includes HUNTA-733, JUL-059, and miaa-201

Your Environment

Actress scrapers

scrape-actress-en=True scrape-actress-ja=True

[General]

Maximum number of threads to sort with if parameter '-Multi' is applied (range 1-15)

multi-sort-throttle-limit=5 move-to-folder=True rename-file=True

Available tags for file/folder rename string

<STUDIO> <YEAR> <RELEASEDATE> <RUNTIME> <ACTORS> <LABEL> <ORIGINALTITLE> <SET></h1> <h1>I do not recommend changing the filename other than <ID> as you may have to manually rename files if you need to re-sort them at a later date</h1> <p>rename-file-string="<ID>" rename-folder-string="<ID> [<STUDIO>] - <TITLE> (<YEAR>)" cms-displayname-string="[<ID>] <TITLE>" actors-name-delimiter=", " poster-file-string="folder" thumbnail-file-string="fanart" trailer-file-string="<ID>-trailer"</p> <h1>nfo-file-string will only apply if create-nfo-per-file=False</h1> <p>nfo-file-string="<ID>" screenshot-folder-string="extrafanart" screenshot-img-string="fanart" actorimg-folder-string=".actors"</p> <h1>Max-title-length will limit the length of your <TITLE> string</h1> <p>max-title-length=100</p> <h1>Max-path-length will limit the sorting of a file if its full path is greater than this number</h1> <p>max-path-length=255</p> <h1>This option will allow Javinizer to ignore video files below a certain size (in MB)</h1> <p>minimum-filesize-to-sort=0 included-file-extensions=asf,avi,flv,m4v,mkv,mp4,mov,rmvb,wmv excluded-file-strings=<em>-trailer.</em>,<em>-5.</em></p> <h1>Allows you to use a regex string to match files if the default Javinizer matcher doesn't work</h1> <h1>(e.g. In regex ([a-zA-Z|tT28]+-\d+z{0,1}Z{0,1}e{0,1}E{0,1})(?:-pt){0,1}(\d{1,2})? , "[ABP-123] Title text-pt3.mp4", match 1 is "ABP-123, match 2 is "3")</h1> <p>regex-match=False</p> <h1>The match value of your movie ID (e.g. "ID-112")</h1> <p>regex-id-match=1</p> <h1>The match value of your movie part number (e.g. "2")</h1> <p>regex-pt-match=2 regex=([a-zA-Z|tT28]+-\d+z{0,1}Z{0,1}e{0,1}E{0,1})(?:-pt){0,1}(\d{1,2})?</p> <p>[Metadata]</p> <h1>General metadata options</h1> <h1>If you use Emby/Jellyfin, create-nfo-per-file is required (nfo is required to have the same filename)</h1> <p>create-nfo=True create-nfo-per-file=True download-thumb-img=True</p> <h1>Download-poster-img requires download-thumb-img to be true</h1> <p>download-poster-img=True download-screenshot-img=False download-trailer-vid=True download-actress-img=False translate-description=True</p> <h1>View language codes: <a rel="noreferrer nofollow" target="_blank" href="https://developers.google.com/admin-sdk/directory/v1/languages">https://developers.google.com/admin-sdk/directory/v1/languages</a></h1> <p>translate-description-language=en</p> <h1>Use this if you want R18 series names to be set as clickable tag in Emby. If you primarily use Plex, you can set this to false.</h1> <p>add-series-as-tag=True</p> <h1>True = FirstName LastName / False = LastName FirstName</h1> <p>first-last-name-order=False</p> <h1>This option will convert actress names matching 'Alias' in r18-thumbs.csv to their original full name</h1> <p>convert-alias-to-originalname=True</p> <h1>This will convert all JavLibrary genres to their R18 counterparts to keep a consistent genre schema. If you want to use JAVLibrary genres, set this to false.</h1> <p>normalize-genres=True</p> <h1>List of genres to ignore in comma separated format (no spaces)</h1> <p>ignored-genres="Featured Actress,Hi-Def"</p> <h1>Metadata scraping priorities</h1> <h1>Javinizer will fail the sort on a movie if any fields listed in required-metadata-fields is null</h1> <p>required-metadata-fields=coverurl,genre,id,maker,title,releasedate,releaseyear actress-priority=r18,javlibrary actressthumburl-priority=r18 alternatetitle-priority=dmm coverurl-priority=r18,dmm,javlibrary description-priority=dmm director-priority=r18,javlibrary genre-priority=r18,javlibrary id-priority=r18,javlibrary label-priority=r18,javlibrary maker-priority=r18,javlibrary rating-priority=dmm ratingcount-priority=dmm releasedate-priority=r18,javlibrary,dmm releaseyear-priority=r18,javlibrary,dmm runtime-priority=r18,javlibrary,dmm series-priority=r18 screenshoturl-priority=r18,dmm title-priority=r18,javlibrary trailerurl-priority=r18</p> <p>[Locations]</p> <h1>These locations will only be used if you are running Javinizer with the -Apply parameter</h1> <p>input-path="F:\R18\JAV_UNORGANIZED" output-path="F:\R18\JAV_ORGANIZED"</p> <p>[Emby/Jellyfin]</p> <h1>You can create an Emby/Jellyfin API key under Dashboard -> Advanced -> Security</h1> <p>server-url=192.168.1.10:8096 server-api-key=b56f075411e44f07a5a03ad97d7f424d</p> <p>[JavLibrary] set-owned=False username=####censored#### session-cookie=####censored#### request-timeout-sec=90</p> <p>[Other]</p> <h1>Log path will default to the javinizer.log file inside your module directory</h1> <p>log-path= check-updates=True verbose-shell-output=True debug-shell-output=True</p> <pre><code></code></pre> </div> </div> <div class="comment"> <div class="user"> <a rel="noreferrer nofollow" target="_blank" href="https://github.com/damenootoko"><img src="https://avatars.githubusercontent.com/u/12018101?v=4" />damenootoko</a> commented <strong> 4 years ago</strong> </div> <div class="markdown-body"> <p>oh, and outside of this, i'm getting 403 failure when getting cover image from r18 <code>WARNING: [2020-09-11T11:16:15][Set-JavMovie] Error downloading cover images Exception: C:\Users\Funster\Documents\PowerShell\Modules\Javinizer\1.7.3\Private\Set-JavMovie.ps1:113 Line | 113 | … $webClient.DownloadFile(($DataObject.CoverUrl).ToString() … | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | Exception calling "DownloadFile" with "2" argument(s): "The remote server returned an error: (403) | Forbidden."</code></p> <p>did they implement some kind of blocking mechanism?</p> </div> </div> <div class="comment"> <div class="user"> <a rel="noreferrer nofollow" target="_blank" href="https://github.com/jvlflame"><img src="https://avatars.githubusercontent.com/u/17932235?v=4" />jvlflame</a> commented <strong> 4 years ago</strong> </div> <div class="markdown-body"> <p>Seems like R18 now requires a User Agent to be included in the header when performing requests on their media resources. I've addressed it in #80 and #82, but seems like that did not solve it completely.</p> <p>I'll have a fix in place for both the v1.x.x and v2.x.x versions shortly.</p> </div> </div> <div class="comment"> <div class="user"> <a rel="noreferrer nofollow" target="_blank" href="https://github.com/damenootoko"><img src="https://avatars.githubusercontent.com/u/12018101?v=4" />damenootoko</a> commented <strong> 4 years ago</strong> </div> <div class="markdown-body"> <p>[update] on 1.7.5 it seems some of it is solved, but the get actress img is still being affected</p> <p><code>WARNING: [2020-09-11T14:28:41][Set-JavMovie] Error downloading actress images Exception: C:\Users\Funster\Documents\PowerShell\Modules\Javinizer\1.7.5\Private\Set-JavMovie.ps1:194 Line | 194 | … $webClient.DownloadFile($actress.thumb, (Join-Path -Path … | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | Exception calling "DownloadFile" with "2" argument(s): "The remote server returned an error: (403) | Forbidden."</code></p> </div> </div> <div class="comment"> <div class="user"> <a rel="noreferrer nofollow" target="_blank" href="https://github.com/jvlflame"><img src="https://avatars.githubusercontent.com/u/17932235?v=4" />jvlflame</a> commented <strong> 4 years ago</strong> </div> <div class="markdown-body"> <p>Resolved with <a href="https://github.com/jvlflame/Javinizer/commit/eb810bcd6298283cfefad23cf02a151678969c15">https://github.com/jvlflame/Javinizer/commit/eb810bcd6298283cfefad23cf02a151678969c15</a>. Going to push 1.7.6 shortly..</p> </div> </div> <div class="comment"> <div class="user"> <a rel="noreferrer nofollow" target="_blank" href="https://github.com/damenootoko"><img src="https://avatars.githubusercontent.com/u/12018101?v=4" />damenootoko</a> commented <strong> 4 years ago</strong> </div> <div class="markdown-body"> <p>allright, it seems to be totally fixed in 1.7.6 but now the -SetEmbyActorThumbs doesn't work with error forbidden, I don't know whether this issue is still related (maybe emby doesn't have the required user agent for r18) or anything else, but if you deemed it unrelated we can close this issue</p> <p>`[2020-09-11T16:01:05][Set-EmbyActors] Writing thumburl [<a href="https://pics.r18.com/mono/actjpgs/yukimi_chinatsu.jpg">https://pics.r18.com/mono/actjpgs/yukimi_chinatsu.jpg</a>] to actor [Yukimi Chinatsu] DEBUG: [2020-09-11T16:01:05][Set-EmbyActors] Performing [POST] on Uri [192.168.1.10:8096/emby/Items/8480/RemoteImages/Download?Type=Thumb&ImageUrl=<a href="https://pics.r18.com/mono/actjpgs/yukimi_chinatsu.jpg&api_key=794569f1206846849527b2f13dff0d2a">https://pics.r18.com/mono/actjpgs/yukimi_chinatsu.jpg&api_key=794569f1206846849527b2f13dff0d2a</a>] Invoke-RestMethod: C:\Users\Funster\Documents\PowerShell\Modules\Javinizer\1.7.6\Private\Set-EmbyActors.ps1:45 Line | 45 | … $rest = Invoke-RestMethod -Method Post -Uri "$embyServerUri/emby/ … | <del>~</del><del>~</del><del>~</del><del>~</del><del>~</del><del>~</del><del>~</del><del>~</del><del>~</del><del>~</del><del>~</del>~~ | Forbidden</p> <p>DEBUG: [2020-09-11T16:01:05][Set-EmbyActors] Performing [POST] on Uri [192.168.1.10:8096/emby/Items/8480/RemoteImages/Download?Type=Primary&ImageUrl=<a href="https://pics.r18.com/mono/actjpgs/yukimi_chinatsu.jpg&api_key=794569f1206846849527b2f13dff0d2a">https://pics.r18.com/mono/actjpgs/yukimi_chinatsu.jpg&api_key=794569f1206846849527b2f13dff0d2a</a>] DEBUG: AAAA VERBOSE: POST <a href="http://192.168.1.10:8096/emby/Items/8480/RemoteImages/Download?Type=Primary&ImageUrl=https://pics.r18.com/mono/actjpgs/yukimi_chinatsu.jpg&api_key=794569f1206846849527b2f13dff0d2a">http://192.168.1.10:8096/emby/Items/8480/RemoteImages/Download?Type=Primary&ImageUrl=https://pics.r18.com/mono/actjpgs/yukimi_chinatsu.jpg&api_key=794569f1206846849527b2f13dff0d2a</a> with 0-byte payload VERBOSE: received 9-byte response of content type text/html Invoke-RestMethod: C:\Users\Funster\Documents\PowerShell\Modules\Javinizer\1.7.6\Private\Set-EmbyActors.ps1:48 Line | 48 | … $rest = Invoke-RestMethod -Method Post -Uri "$embyServerUri/emby/ … | <del>~</del><del>~</del><del>~</del><del>~</del><del>~</del><del>~</del><del>~</del><del>~</del><del>~</del><del>~</del><del>~</del>~~ | Forbidden`</p> <p>(the AAAA line is what i added while doing some debugging, and i don't know whether this 403 is by emby or r18, the get persons list works though)</p> </div> </div> <div class="comment"> <div class="user"> <a rel="noreferrer nofollow" target="_blank" href="https://github.com/damenootoko"><img src="https://avatars.githubusercontent.com/u/12018101?v=4" />damenootoko</a> commented <strong> 4 years ago</strong> </div> <div class="markdown-body"> <p>turns out it really was failure in emby itself <code>2020-09-11 16:12:35.342 Error HttpServer: Error processing request *** Error Report *** Version: 4.4.3.0 Command line: C:\Users\Funster\AppData\Roaming\Emby-Server\system\EmbyServer.dll Operating system: Microsoft Windows NT 6.2.9200.0 64-Bit OS: True 64-Bit Process: True User Interactive: True Runtime: file:///C:/Users/Funster/AppData/Roaming/Emby-Server/system/System.Private.CoreLib.dll System.Environment.Version: 3.1.4 Processor count: 16 Program data path: C:\Users\Funster\AppData\Roaming\Emby-Server\programdata Application directory: C:\Users\Funster\AppData\Roaming\Emby-Server\system MediaBrowser.Model.Net.HttpException: MediaBrowser.Model.Net.HttpException: Forbidden at Emby.Server.Implementations.HttpClientManager.CoreHttpClientManager.SendAsyncInternal(HttpRequestOptions options, String httpMethod) at Emby.Server.Implementations.HttpClientManager.CoreHttpClientManager.SendAsync(HttpRequestOptions options, String httpMethod) at MediaBrowser.Providers.Manager.ProviderManager.SaveImage(BaseItem item, String url, ImageType type, Nullable</code>1 imageIndex, CancellationToken cancellationToken) at MediaBrowser.Api.Images.RemoteImageService.DownloadRemoteImage(BaseItem item, BaseDownloadRemoteImage request) at Emby.Server.Implementations.Services.ServiceController.GetTaskResult(Task task) at Emby.Server.Implementations.Services.ServiceHandler.ProcessRequestAsync(HttpListenerHost appHost, IRequest httpReq, IResponse httpRes, RestPath restPath, String responseContentType, CancellationToken cancellationToken) at Emby.Server.Implementations.HttpServer.HttpListenerHost.RequestHandler(IRequest httpReq, ReadOnlyMemory<code>1 urlString, ReadOnlyMemory</code>1 localPath, CancellationToken cancellationToken) Source: Emby.Server.Implementations TargetSite: Void MoveNext()`</p> <p>So I think it's safe to close this issue, since the problem is in emby itself</p> </div> </div> <div class="comment"> <div class="user"> <a rel="noreferrer nofollow" target="_blank" href="https://github.com/damenootoko"><img src="https://avatars.githubusercontent.com/u/12018101?v=4" />damenootoko</a> commented <strong> 4 years ago</strong> </div> <div class="markdown-body"> <p>Opened feature request on emby board itself <a href="https://emby.media/community/index.php?/topic/89821-override-custom-user-agent-for-remoteimageservice/">https://emby.media/community/index.php?/topic/89821-override-custom-user-agent-for-remoteimageservice/</a></p> <p>can i close this issue @jvlflame ?</p> </div> </div> <div class="comment"> <div class="user"> <a rel="noreferrer nofollow" target="_blank" href="https://github.com/jvlflame"><img src="https://avatars.githubusercontent.com/u/17932235?v=4" />jvlflame</a> commented <strong> 4 years ago</strong> </div> <div class="markdown-body"> <p>Yep, thanks for confirming the fix. As for the Emby stuff, I will do some testing as well.</p> <p>As for version 1.7.x, I haven't tested the Emby/Jellyfin actor functionality in a while, but I rewrote the functionality and tested setting Jellyfin actors with my v2.0.0alpha builds.</p> <p>I'll do some testing with both Emby/Jellyfin on both 1.7.6 and 2.0.0 and we can open another issue if it has stopped working for Emby.</p> </div> </div> <div class="page-bar-simple"> </div> <div class="footer"> <ul class="body"> <li>© <script> document.write(new Date().getFullYear()) </script> Githubissues.</li> <li>Githubissues is a development platform for aggregating issues.</li> </ul> </div> <script src="https://cdn.jsdelivr.net/npm/jquery@3.5.1/dist/jquery.min.js"></script> <script src="/githubissues/assets/js.js"></script> <script src="/githubissues/assets/markdown.js"></script> <script src="https://cdn.jsdelivr.net/gh/highlightjs/cdn-release@11.4.0/build/highlight.min.js"></script> <script src="https://cdn.jsdelivr.net/gh/highlightjs/cdn-release@11.4.0/build/languages/go.min.js"></script> <script> hljs.highlightAll(); </script> </body> </html>