Permalink
Browse files

Fixed Fanarts Problems

  • Loading branch information...
maxpiva committed Dec 5, 2017
1 parent 7a497d3 commit 7f7af3ae2e91704e8a510ee5eaeec38860792849
@@ -27,7 +27,7 @@
<OldToolsVersion>3.5</OldToolsVersion>
<UpgradeBackupLocation>
</UpgradeBackupLocation>
<TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
<TargetFrameworkVersion>v4.6.2</TargetFrameworkVersion>
<TargetFrameworkProfile />
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">

Large diffs are not rendered by default.

Oops, something went wrong.
@@ -2,8 +2,10 @@
using System.Collections.Generic;
using System.ComponentModel;
using System.Diagnostics;
using System.IO;
using System.Reflection;
using System.Windows.Forms;
using Newtonsoft.Json;
using Shoko.Commons;
using Shoko.Commons.Extensions;
using Shoko.Models.Server;
@@ -211,8 +213,7 @@ void lbImportFolders_SelectedIndexChanged(object sender, EventArgs e)
{
txtFolderLocalPath.Text = "";
ImportFolder fldr = _importFolders[lbImportFolders.SelectedIndex];
if (fldr == null) return;
if (fldr == null) return;
txtFolderLocalPath.Text = fldr.GetLocalFileSystemFullPath();
}
@@ -67,7 +67,7 @@ public void DownloadAniDBCover(VM_AniDB_Anime anime, bool forceDownload)
if (!req.ForceDownload)
{
// check to make sure the file actually exists
if (!File.Exists(anime.PosterPath))
if (!File.Exists(anime.PosterPathNoDefaultPlain))
{
imagesToDownload.Add(req);
OnQueueUpdateEvent(new QueueUpdateEventArgs(QueueCount));
@@ -176,7 +176,7 @@ public void DownloadTvDBPoster(VM_TvDB_ImagePoster poster, bool forceDownload)
if (!req.ForceDownload)
{
// check to make sure the file actually exists
if (!File.Exists(poster.FullImagePath))
if (!File.Exists(poster.FullImagePathPlain))
{
imagesToDownload.Add(req);
OnQueueUpdateEvent(new QueueUpdateEventArgs(QueueCount));
@@ -208,7 +208,7 @@ public void DownloadTvDBWideBanner(VM_TvDB_ImageWideBanner wideBanner, bool forc
if (!req.ForceDownload)
{
// check to make sure the file actually exists
if (!File.Exists(wideBanner.FullImagePath))
if (!File.Exists(wideBanner.FullImagePathPlain))
{
imagesToDownload.Add(req);
OnQueueUpdateEvent(new QueueUpdateEventArgs(QueueCount));
@@ -240,7 +240,7 @@ public void DownloadTvDBEpisode(TvDB_Episode episode, bool forceDownload)
if (!req.ForceDownload)
{
// check to make sure the file actually exists
if (!File.Exists(episode.GetFullImagePath()))
if (!File.Exists(episode.GetFullImagePathPlain()))
{
imagesToDownload.Add(req);
OnQueueUpdateEvent(new QueueUpdateEventArgs(QueueCount));
@@ -272,7 +272,7 @@ public void DownloadTvDBFanart(VM_TvDB_ImageFanart fanart, bool forceDownload)
if (!req.ForceDownload)
{
// check to make sure the file actually exists
if (!File.Exists(fanart.FullImagePath) || !File.Exists(fanart.FullThumbnailPath))
if (!File.Exists(fanart.FullImagePathPlain) || !File.Exists(fanart.FullThumbnailPathPlain))
{
imagesToDownload.Add(req);
OnQueueUpdateEvent(new QueueUpdateEventArgs(QueueCount));
@@ -304,7 +304,7 @@ public void DownloadMovieDBPoster(VM_MovieDB_Poster poster, bool forceDownload)
if (!req.ForceDownload)
{
// check to make sure the file actually exists
if (!File.Exists(poster.FullImagePath))
if (!File.Exists(poster.FullImagePathPlain))
{
imagesToDownload.Add(req);
OnQueueUpdateEvent(new QueueUpdateEventArgs(QueueCount));
@@ -336,7 +336,7 @@ public void DownloadMovieDBFanart(VM_MovieDB_Fanart fanart, bool forceDownload)
if (!req.ForceDownload)
{
// check to make sure the file actually exists
if (!File.Exists(fanart.FullImagePath))
if (!File.Exists(fanart.FullImagePathPlain))
{
imagesToDownload.Add(req);
OnQueueUpdateEvent(new QueueUpdateEventArgs(QueueCount));
@@ -563,6 +563,7 @@ private void ProcessImageDownloadRequest(ImageDownloadRequest req)
try
{
string fileName = GetFileName(req, false);
BaseConfig.MyAnimeLog.Write("Image Path: " + fileName);
int entityID = GetEntityID(req);
bool downloadImage;
bool fileExists = File.Exists(fileName);
@@ -597,6 +598,8 @@ private void ProcessImageDownloadRequest(ImageDownloadRequest req)
if (req.ImageType == ImageEntityType.TvDB_FanArt)
{
fileName = GetFileName(req, true);
BaseConfig.MyAnimeLog.Write("Image Path: " + fileName);
entityID = GetEntityID(req);
fileExists = File.Exists(fileName);
@@ -640,6 +643,7 @@ bool LoadAndSaveImage(int entityid, int type, bool thumb, string tempname)
{
try
{
BaseConfig.MyAnimeLog.Write("Trying to load from shokoserver, EntityID: "+entityid+" Type: "+type+" Thumb: "+(thumb ? "yes" : "no"));
imageArray = VM_ShokoServer.Instance.ShokoImages.GetImage(entityid, type, thumb);
imageArray.CopyTo(ms);
try
@@ -648,6 +652,8 @@ bool LoadAndSaveImage(int entityid, int type, bool thumb, string tempname)
}
catch
{
BaseConfig.MyAnimeLog.Write("Error closing input stream");
//ignored
}
if (ms.Length > 0)
@@ -670,15 +676,20 @@ bool LoadAndSaveImage(int entityid, int type, bool thumb, string tempname)
fw?.Dispose();
return false;
}
BaseConfig.MyAnimeLog.Write("Valid image returned");
return true;
}
}
}
BaseConfig.MyAnimeLog.Write("Not a valid image");
return false;
}
catch
catch (Exception e)
{
BaseConfig.MyAnimeLog.Write("Error Loading Image: "+e.ToString());
return false;
}
}
@@ -705,7 +716,9 @@ public void DownloadImage(ImageDownloadRequest req)
{
string fileName = GetFileName(req, false);
int entityID = GetEntityID(req);
BaseConfig.MyAnimeLog.Write("Image Path: " + fileName);
int entityID = GetEntityID(req);
bool fileExists = File.Exists(fileName);
bool downloadImage = !fileExists || req.ForceDownload;
@@ -732,7 +745,9 @@ public void DownloadImage(ImageDownloadRequest req)
if (req.ImageType == ImageEntityType.TvDB_FanArt)
{
fileName = GetFileName(req, true);
entityID = GetEntityID(req);
BaseConfig.MyAnimeLog.Write("Image Path: " + fileName);
entityID = GetEntityID(req);
fileExists = File.Exists(fileName);
downloadImage = !fileExists || req.ForceDownload;

Some generated files are not rendered by default. Learn more.

Oops, something went wrong.
@@ -10,7 +10,7 @@
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>Shoko.MyAnime3</RootNamespace>
<AssemblyName>Anime3</AssemblyName>
<TargetFrameworkVersion>v4.7</TargetFrameworkVersion>
<TargetFrameworkVersion>v4.6.2</TargetFrameworkVersion>
<FileUpgradeFlags>
</FileUpgradeFlags>
<UpgradeBackupLocation>
@@ -87,11 +87,11 @@
<Reference Include="Microsoft.DirectX.Direct3DX, Version=1.0.2911.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35">
<Private>False</Private>
</Reference>
<Reference Include="Nancy.Rest.Annotations, Version=1.4.3.25274, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\Nancy.Rest.Annotations.1.4.3.1-beta\lib\net452\Nancy.Rest.Annotations.dll</HintPath>
<Reference Include="Nancy.Rest.Annotations, Version=1.4.3.7, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\Nancy.Rest.Annotations.1.4.3.7-beta\lib\net452\Nancy.Rest.Annotations.dll</HintPath>
</Reference>
<Reference Include="Nancy.Rest.Client, Version=1.4.3.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\Nancy.Rest.Client.1.4.3.5-beta\lib\net452\Nancy.Rest.Client.dll</HintPath>
<Reference Include="Nancy.Rest.Client, Version=1.4.3.8, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\Nancy.Rest.Client.1.4.3.9-beta\lib\net462\Nancy.Rest.Client.dll</HintPath>
</Reference>
<Reference Include="Newtonsoft.Json, Version=10.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
<HintPath>..\packages\Newtonsoft.Json.10.0.3\lib\net45\Newtonsoft.Json.dll</HintPath>
@@ -234,7 +234,9 @@
<Content Include="Skins\aMPed\Anime3_AnimeInfo.xml" />
<Content Include="Skins\aMPed\Anime3_Calendar.xml" />
<Content Include="Skins\aMPed\Anime3_Char.xml" />
<Content Include="Skins\aMPed\Anime3_Collection.xml" />
<Content Include="Skins\aMPed\Anime3_Collection.xml">
<SubType>Designer</SubType>
</Content>
<Content Include="Skins\aMPed\Anime3_Dummy.xml" />
<Content Include="Skins\aMPed\Anime3_Fanart.Backdrops.xml" />
<Content Include="Skins\aMPed\Anime3_FanArt.xml" />
@@ -300,7 +300,7 @@ protected override void OnShowContextMenu()
if ((anime4 = m_Facade.SelectedListItem.TVTag as VM_AniDB_Anime) != null)
{
CL_Response<CL_AnimeSeries_User> resp = VM_ShokoServer.Instance.ShokoServices.CreateSeriesFromAnime(
anime4.AnimeID, null, VM_ShokoServer.Instance.CurrentUser.JMMUserID);
anime4.AnimeID, null, VM_ShokoServer.Instance.CurrentUser.JMMUserID,false);
if (string.IsNullOrEmpty(resp.ErrorMessage))
Utils.DialogMsg(Translation.Sucess, Translation.SeriesCreated);
else
@@ -3742,8 +3742,14 @@ private ContextMenuAction SearchTheTvDBMenu(VM_AnimeSeries_User ser, string prev
private void LinkAniDBToTVDB(VM_AnimeSeries_User ser, int animeID, EpisodeType anidbEpType, int anidbEpNumber, int tvDBID, int tvSeason, int tvEpNumber)
{
string res = VM_ShokoServer.Instance.ShokoServices.LinkAniDBTvDB(animeID, (int) anidbEpType, anidbEpNumber,
tvDBID, tvSeason, tvEpNumber, null);
CrossRef_AniDB_TvDBV2 cross = new CrossRef_AniDB_TvDBV2();
cross.AnimeID = animeID;
cross.AniDBStartEpisodeType = (int)anidbEpType;
cross.AniDBStartEpisodeNumber = anidbEpNumber;
cross.TvDBID = tvDBID;
cross.TvDBSeasonNumber = tvSeason;
cross.TvDBStartEpisodeNumber = tvEpNumber;
string res = VM_ShokoServer.Instance.ShokoServices.LinkAniDBTvDB(cross);
if (res.Length > 0)
Utils.DialogMsg("Error", res);
@@ -208,7 +208,7 @@ protected override void OnShowContextMenu()
cmenu.AddAction(Translation.CreateSeriesForAnime, () =>
{
CL_Response<CL_AnimeSeries_User> resp = VM_ShokoServer.Instance.ShokoServices.CreateSeriesFromAnime(
rec.RecommendedAnimeID, null, VM_ShokoServer.Instance.CurrentUser.JMMUserID);
rec.RecommendedAnimeID, null, VM_ShokoServer.Instance.CurrentUser.JMMUserID,false);
if (string.IsNullOrEmpty(resp.ErrorMessage))
Utils.DialogMsg(Translation.Sucess, Translation.SeriesCreated);
else
@@ -4,4 +4,4 @@
<bindings/>
<client/>
</system.serviceModel>
<startup><supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.7"/></startup></configuration>
<startup><supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.6.2"/></startup></configuration>
@@ -2,7 +2,7 @@
<packages>
<package id="ILMerge" version="2.14.1208" targetFramework="net46" />
<package id="ImpromptuInterface" version="6.2.2" targetFramework="net462" />
<package id="Nancy.Rest.Annotations" version="1.4.3.1-beta" targetFramework="net462" />
<package id="Nancy.Rest.Client" version="1.4.3.5-beta" targetFramework="net462" />
<package id="Nancy.Rest.Annotations" version="1.4.3.7-beta" targetFramework="net462" />
<package id="Nancy.Rest.Client" version="1.4.3.9-beta" targetFramework="net462" />
<package id="Newtonsoft.Json" version="10.0.3" targetFramework="net462" />
</packages>

0 comments on commit 7f7af3a

Please sign in to comment.