-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Now we check the "episode.firstrun" and "program.title" as well as th…
…e "episode.id" to find if we have downloaded an episode before. This seems to give more accurate results rather than the id.
- Loading branch information
1 parent
0ebf802
commit 4df0e0c
Showing
6 changed files
with
229 additions
and
6 deletions.
There are no files selected for viewing
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
downloads/ | ||
orgranized/ | ||
organized/ | ||
|
||
# Poetry | ||
poetry.lock | ||
|
This file contains 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
This file contains 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
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
from tkinter import W | ||
|
||
from ruv_dl import ruv_client | ||
|
||
|
||
def test_fields(): | ||
programs = ruv_client.RUVClient().get_all_programs() | ||
assert len(programs) > 0 | ||
for program in programs.values(): | ||
assert program["title"], f"Bad program: {program}" | ||
# Most Icelandic shows do not have a foreign title | ||
assert "foreign_title" in program, f"Bad program: {program}" | ||
assert program["id"], f"Bad program: {program}" | ||
# Some audio shows do not have a short description | ||
assert "short_description" in program, f"Bad program: {program}" | ||
assert "episodes" in program, f"Bad program: {program}" | ||
# Some programs have now episodes | ||
for episode in program["episodes"]: | ||
assert "id" in episode, f"Bad episode: {episode}" | ||
assert "title" in episode, f"Bad episode: {episode}" | ||
assert "firstrun" in episode, f"Bad episode: {episode}" | ||
assert "file" in episode, f"Bad episode: {episode}" |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,167 @@ | ||
from ruv_dl.storage import EpisodeDownload, filter_downloaded_episodes | ||
|
||
|
||
def test_filter_downloaded_all_equal(): | ||
downloaded_episodes = [ | ||
EpisodeDownload( | ||
id="1", | ||
program_id="1", | ||
program_title="Program 1", | ||
title="Episode 1", | ||
foreign_title="Foreign title 1", | ||
quality_str="Quality 1", | ||
url="Url 1", | ||
firstrun="Firstrun 1", | ||
) | ||
] | ||
episodes_to_download = [ | ||
EpisodeDownload( | ||
id="1", | ||
program_id="1", | ||
program_title="Program 1", | ||
title="Episode 1", | ||
foreign_title="Foreign title 1", | ||
quality_str="Quality 1", | ||
url="Url 1", | ||
firstrun="Firstrun 1", | ||
) | ||
] | ||
assert filter_downloaded_episodes(downloaded_episodes, episodes_to_download) == [] | ||
|
||
|
||
def test_filter_downloaded_same_title_and_firstrun(): | ||
downloaded_episodes = [ | ||
EpisodeDownload( | ||
id="1", | ||
program_id="1", | ||
program_title="Program 1", | ||
title="Episode 1", | ||
foreign_title="Foreign title 1", | ||
quality_str="Quality 1", | ||
url="Url 1", | ||
firstrun="Firstrun 1", | ||
) | ||
] | ||
episodes_to_download = [ | ||
EpisodeDownload( | ||
id="2", # Different id | ||
program_id="1", | ||
program_title="Program 1", | ||
title="Episode 1", | ||
foreign_title="Foreign title 1", | ||
quality_str="Quality 1", | ||
url="Url 1", | ||
firstrun="Firstrun 1", | ||
) | ||
] | ||
assert filter_downloaded_episodes(downloaded_episodes, episodes_to_download) == [] | ||
|
||
|
||
def test_filter_downloaded_same_id(): | ||
downloaded_episodes = [ | ||
EpisodeDownload( | ||
id="1", | ||
program_id="1", | ||
program_title="Program 1", | ||
title="Episode 1", | ||
foreign_title="Foreign title 1", | ||
quality_str="Quality 1", | ||
url="Url 1", | ||
firstrun="Firstrun 1", | ||
) | ||
] | ||
episodes_to_download = [ | ||
EpisodeDownload( | ||
id="1", | ||
program_id="1", | ||
program_title="Program 2", | ||
title="Episode 1", | ||
foreign_title="Foreign title 1", | ||
quality_str="Quality 1", | ||
url="Url 1", | ||
firstrun="Firstrun 1", | ||
) | ||
] | ||
assert filter_downloaded_episodes(downloaded_episodes, episodes_to_download) == [] | ||
|
||
|
||
def test_filter_downloaded_not_same_title_id(): | ||
downloaded_episodes = [ | ||
EpisodeDownload( | ||
id="1", | ||
program_id="1", | ||
program_title="Program 1", | ||
title="Episode 1", | ||
foreign_title="Foreign title 1", | ||
quality_str="Quality 1", | ||
url="Url 1", | ||
firstrun="Firstrun 1", | ||
) | ||
] | ||
episodes_to_download = [ | ||
EpisodeDownload( | ||
id="2", # Different id | ||
program_id="1", | ||
program_title="Program 2", # Different program_title | ||
title="Episode 1", | ||
foreign_title="Foreign title 1", | ||
quality_str="Quality 1", | ||
url="Url 1", | ||
firstrun="Firstrun 1", | ||
) | ||
] | ||
assert filter_downloaded_episodes(downloaded_episodes, episodes_to_download) == episodes_to_download | ||
|
||
|
||
def test_filter_downloaded_same_id_missing_firstrun(): | ||
downloaded_episodes = [ | ||
EpisodeDownload( | ||
id="1", | ||
program_id="1", | ||
program_title="Program 1", | ||
title="Episode 1", | ||
foreign_title="Foreign title 1", | ||
quality_str="Quality 1", | ||
url="Url 1", | ||
) | ||
] | ||
episodes_to_download = [ | ||
EpisodeDownload( | ||
id="1", | ||
program_id="1", | ||
program_title="Program 1", | ||
title="Episode 1", | ||
foreign_title="Foreign title 1", | ||
quality_str="Quality 1", | ||
url="Url 1", | ||
firstrun="Firstrun 1", | ||
) | ||
] | ||
assert filter_downloaded_episodes(downloaded_episodes, episodes_to_download) == [] | ||
|
||
|
||
def test_filter_downloaded_not_same_id_missing_firstrun(): | ||
downloaded_episodes = [ | ||
EpisodeDownload( | ||
id="1", | ||
program_id="1", | ||
program_title="Program 1", | ||
title="Episode 1", | ||
foreign_title="Foreign title 1", | ||
quality_str="Quality 1", | ||
url="Url 1", | ||
) | ||
] | ||
episodes_to_download = [ | ||
EpisodeDownload( | ||
id="2", | ||
program_id="1", | ||
program_title="Program 1", | ||
title="Episode 1", | ||
foreign_title="Foreign title 1", | ||
quality_str="Quality 1", | ||
url="Url 1", | ||
firstrun="Firstrun 1", | ||
) | ||
] | ||
assert filter_downloaded_episodes(downloaded_episodes, episodes_to_download) == episodes_to_download |