Skip to content
This repository was archived by the owner on Aug 9, 2024. It is now read-only.

Commit ed2bf5f

Browse files
feat(action): add legacy tv agents (#207)
1 parent d6aacba commit ed2bf5f

File tree

4 files changed

+81
-3
lines changed

4 files changed

+81
-3
lines changed

action.yml

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,14 @@ inputs:
7171
description: Do not create a TV Shows library.
7272
default: "false"
7373
required: false
74+
without_shows_tmdb:
75+
description: Do not create a TV Shows library (TMDB agent).
76+
default: "false"
77+
required: false
78+
without_shows_tvdb:
79+
description: Do not create a TV Shows library (TVDB agent).
80+
default: "false"
81+
required: false
7482
outputs:
7583
PLEXTOKEN:
7684
description: The Plex Media Server authentication token.
@@ -352,6 +360,12 @@ runs:
352360
if [[ "${{ inputs.without_shows }}" == "true" ]]; then
353361
without_shows="--without-shows"
354362
fi
363+
if [[ "${{ inputs.without_shows_tmdb }}" == "true" ]]; then
364+
without_shows_tmdb="--without-shows-tmdb"
365+
fi
366+
if [[ "${{ inputs.without_shows_tvdb }}" == "true" ]]; then
367+
without_shows_tvdb="--without-shows-tvdb"
368+
fi
355369
356370
"${{ steps.venv.outputs.python-path }}" \
357371
-u scripts/plex_bootstraptest.py \
@@ -372,6 +386,8 @@ runs:
372386
${without_music} \
373387
${without_photos} \
374388
${without_shows} \
389+
${without_shows_tmdb} \
390+
${without_shows_tvdb} \
375391
--unclaimed
376392
echo "::endgroup::"
377393

scripts/plex_bootstraptest.py

Lines changed: 43 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -480,6 +480,20 @@ def alert_callback(data):
480480
dest="with_shows",
481481
action="store_false",
482482
) # noqa
483+
parser.add_argument(
484+
"--without-shows-tmdb",
485+
help="Do not create TV Shows (tmdb agent) section",
486+
default=True,
487+
dest="with_shows_tmdb",
488+
action="store_false",
489+
) # noqa
490+
parser.add_argument(
491+
"--without-shows-tvdb",
492+
help="Do not create TV Shows (tvdb agent) section",
493+
default=True,
494+
dest="with_shows_tvdb",
495+
action="store_false",
496+
) # noqa
483497
opts, _ = parser.parse_known_args()
484498

485499
account = get_plex_account(opts)
@@ -644,10 +658,10 @@ def alert_callback(data):
644658
)
645659

646660
# Prepare TV Show section
647-
if opts.with_shows:
648-
tvshows_path = os.path.join(media_path, "TV-Shows")
649-
num_ep = setup_show(tvshows_path)
661+
tvshows_path = os.path.join(media_path, "TV-Shows")
662+
num_ep = setup_show(tvshows_path)
650663

664+
if opts.with_shows:
651665
sections.append(
652666
dict(
653667
name="TV Shows",
@@ -660,6 +674,32 @@ def alert_callback(data):
660674
)
661675
)
662676

677+
if opts.with_shows_tmdb:
678+
sections.append(
679+
dict(
680+
name="TV Shows-tmdb",
681+
type="show",
682+
location="/data/TV-Shows" if opts.no_docker is False else tvshows_path,
683+
agent="com.plexapp.agents.themoviedb",
684+
scanner="Plex Series Scanner",
685+
# language="en-US",
686+
expected_media_count=num_ep,
687+
)
688+
)
689+
690+
if opts.with_shows_tvdb:
691+
sections.append(
692+
dict(
693+
name="TV Shows-tvdb",
694+
type="show",
695+
location="/data/TV-Shows" if opts.no_docker is False else tvshows_path,
696+
agent="com.plexapp.agents.thetvdb",
697+
scanner="Plex Series Scanner",
698+
# language="en-US",
699+
expected_media_count=num_ep,
700+
)
701+
)
702+
663703
# Prepare Music section
664704
if opts.with_music:
665705
music_path = os.path.join(media_path, "Music")

tests/conftest.py

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -152,6 +152,18 @@ def tv_shows_section(plex):
152152
return section
153153

154154

155+
@pytest.fixture()
156+
def tv_shows_tmdb_section(plex):
157+
section = plex.library.section("TV Shows-tmdb")
158+
return section
159+
160+
161+
@pytest.fixture()
162+
def tv_shows_tvdb_section(plex):
163+
section = plex.library.section("TV Shows-tvdb")
164+
return section
165+
166+
155167
@pytest.fixture()
156168
def music_section(plex):
157169
section = plex.library.section("Music")

tests/functional/test_boostrapping.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,16 @@ def test_tv_shows_section(tv_shows_section):
2121
assert show, "Show not found."
2222

2323

24+
def test_tv_shows_tmdb_section(tv_shows_tmdb_section):
25+
show = tv_shows_tmdb_section.get("Game of Thrones")
26+
assert show, "Show not found."
27+
28+
29+
def test_tv_shows_tvdb_section(tv_shows_tvdb_section):
30+
show = tv_shows_tvdb_section.get("Game of Thrones")
31+
assert show, "Show not found."
32+
33+
2434
def test_music_section(music_section):
2535
artist = music_section.get("Broke For Free")
2636
assert artist, "Artist not found."

0 commit comments

Comments
 (0)