Skip to content

Commit

Permalink
Files with corrupt names are now downloaded properly.
Browse files Browse the repository at this point in the history
+ minor GUI scaling fix
+ descriptions are now saved properly
  • Loading branch information
crouvpony47 committed Dec 3, 2017
1 parent 197ebb9 commit 48cec40
Show file tree
Hide file tree
Showing 5 changed files with 61 additions and 30 deletions.
7 changes: 6 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,12 @@ Yet another mass downloader for FurAffinity.net.



[Download stable win32 build.](https://github.com/crouvpony47/furdown/raw/master/bin-stable/furdown.exe)
[Download stable win32 build.](https://github.com/crouvpony47/furdown/raw/master/bin-stable/furdown.exe) (v.0.3.2.0)

Changelog (v.0.3.2.0):
- files with corrupt names are now downloaded properly,
- descriptions are now saved properly (relative paths changed to absolute ones),
- minor GUI scaling fix

System requirements:

Expand Down
Binary file modified bin-stable/furdown.exe
Binary file not shown.
44 changes: 33 additions & 11 deletions src/AppCore.cs
Original file line number Diff line number Diff line change
Expand Up @@ -201,15 +201,20 @@ public async Task<ProcessingResults> ProcessSubmissionsList(List<string> subs, b
string subId = subs[i];
// don't care about empty strings
if (subId == null || subId.CompareTo("") == 0) continue;
Console.WriteLine("> Processing submission #" + subId);
// check if in DB already
try
{
if (SubmissionsDB.DB.Exists(uint.Parse(subId))
&& GlobalSettings.Settings.downloadOnlyOnce) continue;
if (SubmissionsDB.DB.Exists(uint.Parse(subId))
&& GlobalSettings.Settings.downloadOnlyOnce)
{
Console.WriteLine("Skipped (present in DB)");
continue;
}
}
catch
{
Console.WriteLine("Unexpected ");
Console.WriteLine("Unexpected error (DB presence check failed)!");
continue;
}
string subUrl = "https://www.furaffinity.net/view/" + subId;
Expand All @@ -231,7 +236,7 @@ public async Task<ProcessingResults> ProcessSubmissionsList(List<string> subs, b
goto beforeawait;
else
{
Console.WriteLine("Giving up on {0}", subId);
Console.WriteLine("Giving up on #" + subId);
res.failedToGetPage.Add(subId);
continue;
}
Expand All @@ -258,17 +263,33 @@ public async Task<ProcessingResults> ProcessSubmissionsList(List<string> subs, b
cpage = cpage.Substring(0,
cpage.IndexOf(desckeyend, cpage.IndexOf(desckeyend) + 1) + desckeyend.Length
);
cpage.Replace("href=\"/", "href=\"https://furaffinity.net/");
cpage.Replace("src=\"//", "src=\"https://");
cpage = cpage.Replace("href=\"/", "href=\"https://furaffinity.net/");
cpage = cpage.Replace("src=\"//", "src=\"https://");
}
sp.ARTIST = sp.URL.Substring(sp.URL.LastIndexOf(@"/art/") + 5);
sp.ARTIST = sp.ARTIST.Substring(0, sp.ARTIST.IndexOf('/'));
sp.FILEFULL = sp.URL.Substring(sp.URL.LastIndexOf('/') + 1);
// remove characters windows filename can't hold
sp.FILEFULL = string.Concat(sp.FILEFULL.Split(Path.GetInvalidFileNameChars(), StringSplitOptions.RemoveEmptyEntries));
sp.FILEID = sp.FILEFULL.Substring(0, sp.FILEFULL.IndexOf('.'));
sp.ARTIST = sp.FILEFULL.Substring(sp.FILEFULL.IndexOf('.') + 1);
sp.ARTIST = sp.ARTIST.Substring(0, sp.ARTIST.IndexOf('_'));
sp.FILEPART = sp.FILEFULL.Substring(sp.FILEFULL.IndexOf('_') + 1);
sp.EXT = (sp.FILEFULL + " ").Substring(sp.FILEFULL.LastIndexOf('.') + 1).TrimEnd();
if (sp.FILEFULL.IndexOf('_') >= 0) // valid filename (some names on FA are corrupted and contain nothing but '.' after ID)
{
sp.FILEPART = sp.FILEFULL.Substring(sp.FILEFULL.IndexOf('_') + 1);
if (sp.FILEFULL.LastIndexOf('.') >= 0) // has extension
{
sp.EXT = (sp.FILEFULL + " ").Substring(sp.FILEFULL.LastIndexOf('.') + 1).TrimEnd();
if (sp.EXT.CompareTo("") == 0)
sp.EXT = @"jpg";
}
else
{
sp.EXT = @"jpg";
}
}
else
{
sp.FILEPART = @"unknown.jpg";
sp.EXT = @"jpg";
}
// apply template(s)
string fname = GlobalSettings.Settings.filenameTemplate;
string dfname = GlobalSettings.Settings.descrFilenameTemplate;
Expand Down Expand Up @@ -345,6 +366,7 @@ in sp.GetType().GetFields(
continue;
}
}
Console.WriteLine("Done: #" + subId);
res.processedPerfectly++;
}
// writing results
Expand Down
4 changes: 2 additions & 2 deletions src/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
// Можно задать все значения или принять номера сборки и редакции по умолчанию
// используя "*", как показано ниже:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("0.3.1.0")]
[assembly: AssemblyFileVersion("0.3.1.0")]
[assembly: AssemblyVersion("0.3.2.0")]
[assembly: AssemblyFileVersion("0.3.2.0")]
[assembly: NeutralResourcesLanguage("en")]

36 changes: 20 additions & 16 deletions src/taskForm.Designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 48cec40

Please sign in to comment.