first of all a warm welcome to all of you cause I’m new here
I wonder why my Script is not giving me the expected output. Pre-Conditions of my script –> There is a CSV-file in the same-directory as the script itself which is filled with series I watch, which are saved on my homeserver. Format is the following …
csv_seriesid;csv_seriesname;last_on_tvdb;csv_status;tvdb_query
337907;9-1-1 Notruf L.A;S03E18;Continuing;https://thetvdb.com/search?query=337907
328569;Atlanta Medical;S03E20;Continuing;https://thetvdb.com/search?query=328569
164981;Blue Bloods - Crime Scene New York;S10E19;Continuing;https://thetvdb.com/search?query=164981
My Script is the following which should give me an output which series I do have on my home-server and which series is the last one-listed on TVDB so that I know If I’m behind with my downloads or not.
The only thing which is not working is the value “lastontvdb” in my custom-object (it’s simply empty in the output). Maybe you can help me out with that?
Also tried this of course - but also with no result. I tried with something like
($csv -match "9-1-1").last_on_tvdb
which works on console directly but not in the script - or let me say not as expected.
This is the output then ?!
Series episodenr lastontvdb episodename
------ --------- ---------- -----------
9-1-1 Notruf L.A. S03E10 S03E18 Wendepunkte.mkv
Atlanta Medical S02E23 Sinneswandel.mkv
Atlanta Medical S03E14 Der Floh.mkv
Chicago Fire S08E20 Nächste Schritte.mkv
Chicago Med S05E20 Alte Wunden.mkv
Chicago PD S07E20 Todesstille.mkv
Criminal Minds S15E10 Der Anfang vom Ende (2).mkv
FBI Special Crime Unit S02E11 Todesengel.mkv
Grey's Anatomy S16E21 Gute Miene, böses Spiel.mkv
Hawaii Five-0 S10E22 Aloha Oe.mkv
Lincoln Rhyme Der Knochenjäger S01E10 Auge in Auge (2).mkv
Lucifer S05E08 Spoileralarm.mp4
Marvel's Agents of S.H.I.E.L.D. S03E22 S07E13 Himmelfahrtskommando (2).mkv
Marvel's Agents of S.H.I.E.L.D. S04E22 S07E13 Das Ende der Welt.mkv
Mysterious Mermaids S02E16 Schöne neue Welt.mkv
Mysterious Mermaids S03E04 Ryns Baby!.mkv
New Amsterdam S02E09 Die Insel.mkv
SEAL Team S03E20 Wofür man kämpft.mkv
The 100 S04E13 Praimfaya.mkv
The 100 S05E13 Damokles (2).mkv
The 100 S06E13 Das Blut Sanctums.mkv
The Blacklist S05E22 Sutton Ross (Nr. 17).mkv
The Blacklist S06E22 Robert Diaz (Nr. 15).mkv
The Blacklist S07E19 Die Kazanjian-Brüder.mkv
The Flash (2014) S05E22 Das Vermächtnis.mkv
The Flash (2014) S06E19 Der Erfolg ist garantiert.mkv
The Good Doctor S02E18 Trampolin.mkv
The Good Doctor S03E18 Willkommen im Club.mkv
The Walking Dead S07E16 Heute beginnt der Rest des Lebens.mkv
The Walking Dead S08E16 Zorn.mkv
The Walking Dead S09E16 Der Sturm.mkv
The Walking Dead S10E15 Prinzessin.mkv
What is the strucuture of your variable $array ?
I think there is a mistake with your regex when you apply the split.
You may to use both your $csv varable and your $array variable to filter and then extract the given value.
PS Microsoft.PowerShell.Core\FileSystem::\\hestia\series> .\missing_series.ps1 -last
9-1-1 Notruf L.A. - S03E10 - Wendepunkte.mkv
Atlanta Medical - S02E23 - Sinneswandel.mkv
Atlanta Medical - S03E14 - Der Floh.mkv
Chicago Fire - S08E20 - Nächste Schritte.mkv
Chicago Med - S05E20 - Alte Wunden.mkv
Chicago PD - S07E20 - Todesstille.mkv
Criminal Minds - S15E10 - Der Anfang vom Ende (2).mkv
FBI Special Crime Unit - S02E11 - Todesengel.mkv
Grey's Anatomy - S16E21 - Gute Miene, böses Spiel.mkv
Hawaii Five-0 - S10E22 - Aloha Oe.mkv
Lincoln Rhyme Der Knochenjäger - S01E10 - Auge in Auge (2).mkv
Lucifer - S05E08 - Spoileralarm.mp4
Marvel's Agents of S.H.I.E.L.D. - S03E22 - Himmelfahrtskommando (2).mkv
Marvel's Agents of S.H.I.E.L.D. - S04E22 - Das Ende der Welt.mkv
Mysterious Mermaids - S02E16 - Schöne neue Welt.mkv
Mysterious Mermaids - S03E04 - Ryns Baby!.mkv
New Amsterdam - S02E09 - Die Insel.mkv
SEAL Team - S03E20 - Wofür man kämpft.mkv
The 100 - S04E13 - Praimfaya.mkv
The 100 - S05E13 - Damokles (2).mkv
The 100 - S06E13 - Das Blut Sanctums.mkv
The Blacklist - S05E22 - Sutton Ross (Nr. 17).mkv
The Blacklist - S06E22 - Robert Diaz (Nr. 15).mkv
The Blacklist - S07E19 - Die Kazanjian-Brüder.mkv
The Flash (2014) - S05E22 - Das Vermächtnis.mkv
The Flash (2014) - S06E19 - Der Erfolg ist garantiert.mkv
The Good Doctor - S02E18 - Trampolin.mkv
The Good Doctor - S03E18 - Willkommen im Club.mkv
The Walking Dead - S07E16 - Heute beginnt der Rest des Lebens.mkv
The Walking Dead - S08E16 - Zorn.mkv
The Walking Dead - S09E16 - Der Sturm.mkv
The Walking Dead - S10E15 - Prinzessin.mkv
That’s why I’m splitting with regex to get it “more structured”
I use the $csv variable to compare the csv_seriesname field to the first split of your array and then take the last_on_tvdb from your $csv variable. You must take a attention of the integrity of your csv file the field csv_seriesname is not perfectly egal to the data feed on your array.
For example:
On CSV csv_seriesname –> 9-1-1 Notruf L.A On your array $item_series –> 9-1-1 Notruf L.A. There is a dot on the end of your data, so the statement can’t be true and you can’t get your value.
Your approach is a good one. The difference in both data sources results in one simple fact.
There is no “.” allowed as last character in a directory at windows-filesystems - I got the data from the series-db from thetvdb. I’ll try to find a workaround on that on my own.