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:
parent
b6d43273cf
commit
b498c242af
4 changed files with 88 additions and 62 deletions
|
@ -1,58 +1,60 @@
|
||||||
{
|
{
|
||||||
"cache_limit":"-1",
|
"queue": {
|
||||||
|
"active_lang": "en",
|
||||||
|
"cache_art": "0",
|
||||||
|
"cache_max": "67108864",
|
||||||
|
"cache_size": "0 B",
|
||||||
"categories": [
|
"categories": [
|
||||||
"None",
|
"*",
|
||||||
"apps",
|
"apps",
|
||||||
"books",
|
|
||||||
"consoles",
|
"consoles",
|
||||||
"emulation",
|
"emp",
|
||||||
"games",
|
|
||||||
"misc",
|
|
||||||
"movies",
|
"movies",
|
||||||
"music",
|
|
||||||
"pda",
|
|
||||||
"resources",
|
|
||||||
"tv"
|
"tv"
|
||||||
],
|
],
|
||||||
"scripts":[
|
"color_scheme": "lightblue",
|
||||||
"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,
|
"darwin": false,
|
||||||
"nt":true,
|
"diskspace1": "127.50",
|
||||||
"last_warning":"",
|
"diskspace2": "127.50",
|
||||||
"have_warnings":"0",
|
"diskspacetotal1": "157.76",
|
||||||
"cache_art":"0",
|
"diskspacetotal2": "157.76",
|
||||||
"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",
|
"eta": "unknown",
|
||||||
"nzb_quota":"",
|
"finish": 0,
|
||||||
"loadavg":"",
|
"finishaction": null,
|
||||||
"limit":0,
|
"have_warnings": "20",
|
||||||
|
"helpuri": "http://wiki.sabnzbd.org/",
|
||||||
|
"isverbose": false,
|
||||||
"kbpersec": "0.00",
|
"kbpersec": "0.00",
|
||||||
"speedlimit":"0",
|
"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:",
|
||||||
"webdir":"path\\to\\templates",
|
"limit": 0,
|
||||||
"queue_details":"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"));
|
.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();
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -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;
|
||||||
|
|
||||||
|
|
|
@ -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)
|
||||||
|
|
Loading…
Reference in a new issue