Fixed QueueEmpty.txt json file.

pull/6/head
kay.one 13 years ago
parent b6d43273cf
commit b498c242af

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

@ -53,6 +53,15 @@ namespace NzbDrone.Core.Test.ProviderTests
.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()
{
Mocker.GetMock<HttpProvider>()
@ -367,6 +376,25 @@ namespace NzbDrone.Core.Test.ProviderTests
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();
}
}

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

@ -90,7 +90,8 @@ namespace NzbDrone.Core.Providers
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)

Loading…
Cancel
Save