1
0
Fork 0
mirror of https://github.com/Sonarr/Sonarr synced 2024-12-25 17:27:18 +00:00

Fixed QueueEmpty.txt json file.

This commit is contained in:
kay.one 2012-01-19 23:36:29 -08:00
parent b6d43273cf
commit b498c242af
4 changed files with 88 additions and 62 deletions

View file

@ -1,58 +1,60 @@
{ {
"cache_limit":"-1", "queue": {
"categories":[ "active_lang": "en",
"None", "cache_art": "0",
"cache_max": "67108864",
"cache_size": "0 B",
"categories": [
"*",
"apps", "apps",
"books",
"consoles", "consoles",
"emulation", "emp",
"games",
"misc",
"movies", "movies",
"music",
"pda",
"resources",
"tv" "tv"
], ],
"scripts":[ "color_scheme": "lightblue",
"None" "darwin": false,
], "diskspace1": "127.50",
"paused":true, "diskspace2": "127.50",
"new_rel_url":"", "diskspacetotal1": "157.76",
"restart_req":false, "diskspacetotal2": "157.76",
"slots":[ ], "eta": "unknown",
"helpuri":"http://wiki.sabnzbd.org/", "finish": 0,
"uptime":"6m", "finishaction": null,
"refresh_rate":"", "have_warnings": "20",
"isverbose":false, "helpuri": "http://wiki.sabnzbd.org/",
"start":0, "isverbose": false,
"version":"trunk", "kbpersec": "0.00",
"diskspacetotal2":"503.32", "last_warning": "2012-01-19 22:47:17,726\nWARNING:\nAPI Key incorrect, Use the api key from Config->General in your 3rd party program:",
"color_scheme":"", "limit": 0,
"darwin":false, "loadavg": "",
"nt":true, "mb": "0.00",
"last_warning":"", "mbleft": "0.00",
"have_warnings":"0", "new_rel_url": "http://sourceforge.net/projects/sabnzbdplus/files/sabnzbdplus/sabnzbd-0.6.14",
"cache_art":"0", "new_release": "0.6.14",
"finishaction":null, "newzbinDetails": true,
"noofslots":1, "noofslots": 0,
"cache_size":"0", "nt": true,
"finish":0, "nzb_quota": "",
"new_release":"", "pause_int": "0",
"pause_int":"0" "paused": false,
,"mbleft":"785.89", "paused_all": false,
"diskspace2":"25.08", "power_options": true,
"diskspace1":"25.08", "queue_details": "0",
"diskspacetotal1":"503.32", "refresh_rate": "20",
"timeleft":"0:00:00", "restart_req": false,
"mb":"785.89", "scripts": [],
"newzbinDetails":true, "session": "f37dc33baec2e5566f5aec666287870d",
"eta":"unknown", "size": "0 B",
"nzb_quota":"", "sizeleft": "0 B",
"loadavg":"", "slots": [],
"limit":0, "speed": "0 ",
"kbpersec":"0.00", "speedlimit": "",
"speedlimit":"0", "start": 0,
"webdir":"path\\to\\templates", "status": "Idle",
"queue_details":"0" "timeleft": "0:00:00",
"uptime": "2d",
"version": "0.6.9",
"webdir": "C:\\Tools\\SABnzbd\\interfaces\\Classic\\templates"
}
} }

View file

@ -53,6 +53,15 @@ namespace NzbDrone.Core.Test.ProviderTests
.Returns(File.ReadAllText(@".\Files\Queue.txt")); .Returns(File.ReadAllText(@".\Files\Queue.txt"));
} }
private void WithEmptyQueue()
{
Mocker.GetMock<HttpProvider>()
.Setup(s => s.DownloadString("http://192.168.5.55:2222/api?mode=queue&output=json&start=0&limit=0&apikey=5c770e3197e4fe763423ee7c392c25d1&ma_username=admin&ma_password=pass"))
.Returns(File.ReadAllText(@".\Files\QueueEmpty.txt"));
}
private void WithFailResponse() private void WithFailResponse()
{ {
Mocker.GetMock<HttpProvider>() Mocker.GetMock<HttpProvider>()
@ -367,6 +376,25 @@ namespace NzbDrone.Core.Test.ProviderTests
result.Should().BeTrue(); result.Should().BeTrue();
} }
[Test]
public void IsInQueue_should_return_false_if_queue_is_empty()
{
WithEmptyQueue();
var parseResult = new EpisodeParseResult
{
EpisodeTitle = "Title",
EpisodeNumbers = new List<int>{1},
SeasonNumber = 2,
Quality = new Quality { QualityType = QualityTypes.Bluray1080p, Proper = true },
Series = new Series { Title = "Test" },
};
var result = Mocker.Resolve<SabProvider>().IsInQueue(parseResult);
result.Should().BeFalse();
}
} }

View file

@ -181,21 +181,16 @@ namespace NzbDrone.Core.Providers
return false; return false;
} }
//Ensure the folder Exists before trying to move it (No error is thrown if the folder already exists)
_diskProvider.CreateDirectory(newFile.DirectoryName); _diskProvider.CreateDirectory(newFile.DirectoryName);
//Rename the file
Logger.Debug("Moving [{0}] > [{1}]", episodeFile.Path, newFile.FullName); Logger.Debug("Moving [{0}] > [{1}]", episodeFile.Path, newFile.FullName);
_diskProvider.MoveFile(episodeFile.Path, newFile.FullName); _diskProvider.MoveFile(episodeFile.Path, newFile.FullName);
//Make the file inherit parent permissions
_diskProvider.InheritFolderPermissions(newFile.FullName); _diskProvider.InheritFolderPermissions(newFile.FullName);
//Update the filename in the DB
episodeFile.Path = newFile.FullName; episodeFile.Path = newFile.FullName;
_mediaFileProvider.Update(episodeFile); _mediaFileProvider.Update(episodeFile);
//ExternalNotification
var parseResult = Parser.ParsePath(episodeFile.Path); var parseResult = Parser.ParsePath(episodeFile.Path);
parseResult.Series = series; parseResult.Series = series;

View file

@ -90,7 +90,8 @@ namespace NzbDrone.Core.Providers
CheckForError(response); CheckForError(response);
return JsonConvert.DeserializeObject<SabQueue>(response).Items; var items = JsonConvert.DeserializeObject<SabQueue>(response).Items;
return items ?? new List<SabQueueItem>();
} }
public virtual List<SabHistoryItem> GetHistory(int start = 0, int limit = 0) public virtual List<SabHistoryItem> GetHistory(int start = 0, int limit = 0)