Created
April 30, 2013 22:00
-
-
Save mondalaci/5492275 to your computer and use it in GitHub Desktop.
My patch to Album Art Downloader - more info at http://www.hydrogenaudio.org/forums/index.php?showtopic=57392&st=1400&p=716037&#entry716037
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Index: CommandArgsHelp.txt | |
=================================================================== | |
--- CommandArgsHelp.txt (revision 241) | |
+++ CommandArgsHelp.txt (working copy) | |
@@ -104,6 +104,12 @@ | |
sources to search. | |
May be abbreviated to /l (/l) | |
+ /fetchAll Saves every results to the filesystem. (/fetchAll) | |
+ The %sequence% variable must be used in order for | |
+ the filenames to be unique for every results, | |
+ otherwise they will be overwritten by each other. | |
+ May be abbreviated to /a (/a) | |
+ | |
Exit errorlevel codes: | |
0 Success | |
Index: Program.cs | |
=================================================================== | |
--- Program.cs (revision 241) | |
+++ Program.cs (working copy) | |
@@ -13,7 +13,7 @@ | |
static int Main(string[] args) | |
{ | |
bool origCursorVisible = Console.CursorVisible; //To restore it to its previous state | |
- Console.CursorVisible = false; | |
+ Console.CursorVisible = true; | |
try | |
{ | |
Console.Write("Album Art Downloader XUI Command Line Interface version "); | |
@@ -64,6 +64,7 @@ | |
Orientation requiredOrientation = Orientation.None; | |
bool warnIfNoSearch = false; //If search-like parameters are present, warn if search terms are not. | |
+ bool doFetchAllResults = false; | |
string errorMessage = null; | |
foreach (Parameter parameter in arguments) | |
{ | |
@@ -231,6 +232,10 @@ | |
ListScripts(); | |
//No warnIfNoSearch | |
break; | |
+ case "fetchall": | |
+ case "a": | |
+ doFetchAllResults = true; | |
+ break; | |
default: | |
errorMessage = "Unexpected command line parameter: " + parameter.Name; | |
break; | |
@@ -301,7 +306,7 @@ | |
//perform the actual search | |
try | |
{ | |
- if (Search(scripts, artist, album, path, minSize, maxSize, minAspect, requiredOrientation, coverType, sequence)) | |
+ if (Search(scripts, artist, album, path, minSize, maxSize, minAspect, requiredOrientation, coverType, sequence, doFetchAllResults)) | |
{ | |
return 0; //Success | |
} | |
@@ -337,7 +342,7 @@ | |
/// <summary> | |
/// Perform the actual search, download and save of art | |
/// </summary> | |
- private static bool Search(IEnumerable<IScript> scripts, string artist, string album, string path, int? minSize, int? maxSize, float minAspect, Orientation requiredOrientation, AllowedCoverType? coverType, int targetSequence) | |
+ private static bool Search(IEnumerable<IScript> scripts, string artist, string album, string path, int? minSize, int? maxSize, float minAspect, Orientation requiredOrientation, AllowedCoverType? coverType, int targetSequence, bool doFetchAllResults) | |
{ | |
//Replace the artist and album placeholders in the path | |
path = path.Replace("%artist%", MakeSafeForPath(artist)) | |
@@ -363,11 +368,14 @@ | |
CheckImageDimensions(result, minSize, maxSize, minAspect, requiredOrientation, false) && //Quick check of reported dimensions | |
CheckImageDimensions(result, minSize, maxSize, minAspect, requiredOrientation, true)) //Full check of downloaded image dimensions | |
{ | |
- if (++sequence == targetSequence) //Discard sequence-1 results. | |
+ if (++sequence == targetSequence || doFetchAllResults) //Discard sequence-1 results. | |
{ | |
if (result.Save(path, sequence)) | |
{ | |
- return true; | |
+ if (!doFetchAllResults) | |
+ { | |
+ return true; | |
+ } | |
} | |
else | |
{ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment