Help me to understand why it’s not working

Welcome Forums General PowerShell Q&A Help me to understand why it’s not working

Viewing 10 reply threads
  • Author
    Posts
    • #263798
      Participant
      Topics: 1
      Replies: 5
      Points: 22
      Rank: Member

      Hi Guys,

      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 …

      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?

      Thx in advance!
      Florian

    • #263807
      Participant
      Topics: 0
      Replies: 6
      Points: 55
      Rank: Member

      Hi Florian, 

      And welcome, i’am new too on this community.

      For your problem, why did you don’t use your variable $csv ?
      You’ve got all informations here, with the cmdlet Import-CSV.

      Regards,
      Jocelyn

       

    • #263810
      Participant
      Topics: 1
      Replies: 5
      Points: 22
      Rank: Member

      Hi Florian,

      And welcome, i’am new too on this community.

      For your problem, why did you don’t use your variable $csv ?

      You’ve got all informations here, with the cmdlet Import-CSV.

      Regards,

      Jocelyn

      Hey Jocelyn,

      Also tried this of course – but also with no result. I tried with something like

      which works on console directly but not in the script – or let me say not as expected.

      This is the output then ?!

       

      Thx

    • #263819
      Participant
      Topics: 0
      Replies: 6
      Points: 55
      Rank: Member

      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.

    • #263834
      Participant
      Topics: 1
      Replies: 5
      Points: 22
      Rank: Member

      ter and then extract

      my array looks like that –>

      That’s why I’m splitting with regex to get it “more structured”

    • #263846
      Participant
      Topics: 0
      Replies: 6
      Points: 55
      Rank: Member

      Ok, Here is my approch:

      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.

    • #263852
      Participant
      Topics: 1
      Replies: 5
      Points: 22
      Rank: Member

      Hi,

      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.

      I would to thank you very very much on this!

    • #263855
      Participant
      Topics: 1
      Replies: 5
      Points: 22
      Rank: Member

      db

      it works this way –>

              $pattern = $item_series.trim()
              $lastontvdb = ($csv | Where-Object { $_.csv_seriesname -like "*$pattern*" }).last_on_tvdb
      there is just NO match for the word “Knochenj√§ger” although I used UTF8 as encoding … strange
    • #263864
      Participant
      Topics: 0
      Replies: 6
      Points: 55
      Rank: Member

      The character ä to UTF8 return something not readable.

      Knochenjäger РUTF8 -> Knochenjäger

      Maybe applying a regex for theses special characters.

    • #263867
      Participant
      Topics: 0
      Replies: 6
      Points: 55
      Rank: Member
    • #264323
      Participant
      Topics: 1
      Replies: 5
      Points: 22
      Rank: Member

      I found this https://community.idera.com/database-tools/powershell/powertips/b/tips/posts/replacing-special-chars-like-umlauts

      Hey,

      thx for your insights. I’ll try to get this working. But the main work is done (it’s not that tragical for this one “bone-collector” series :))

      Cheers & Thx

Viewing 10 reply threads
  • You must be logged in to reply to this topic.