Cloud9Developer / Jellyfin-Newsletter-Plugin

GNU General Public License v3.0
66 stars 7 forks source link

Mail with news files note leaving #112

Open FrRene06 opened 1 month ago

FrRene06 commented 1 month ago

good morning,

first of all, thank you for the plug-in.

But although the mail test works, the mail with the news content doesn't leave.

I enclose the program log.

Thanx for your help.

Kind regards,

Laurent 2024-06-02_Newsletter.log

Cloud9Developer commented 1 month ago

Looks like it scanned, but had an error processing every item? Can you turn on debug mode, try again, and send me new logs?

FrRene06 commented 1 month ago

hello, Ok. Thanx for your Help !

Laurent. [Uploading 2024-06-03_Newsletter.log…]()

mastamjay commented 1 month ago

It's exactly the same for me after updating to Jellyfin 10.9.3 and NLP 0.6.4.2.

I had already posted in the Jellyfin Plugin Forum.

p37307 commented 1 month ago

Not sure if this is what is going on with you, but I looked in the config file jellyfin\plugins\configurations\Jellyfin.Plugin.Newsletters.xml for Windows 10 and had to change <NewsletterDir> path from \cache\temp/Newsletters/ to \cache\temp\Newsletters\ and manually created the Newsletters folder.

It worked after that.

mastamjay commented 1 month ago

Thank you for your help. I have changed it, but unfortunately no newsletter is sent out. Test email works 100%.

Does the newsletter work with Jellyfin Server for Windows?

Cloud9Developer commented 1 month ago

Not sure if this is what is going on with you, but I looked in the config file jellyfin\plugins\configurations\Jellyfin.Plugin.Newsletters.xml for Windows 10 and had to change <NewsletterDir> path from \cache\temp/Newsletters/ to \cache\temp\Newsletters\ and manually created the Newsletters folder.

It worked after that.

@p37307 Ahh, looks like unix paths and windows don't mesh.. Can you open an issue for this? I'll see if I can find a way to get that fixed

Cloud9Developer commented 1 month ago

Thank you for your help. I have changed it, but unfortunately no newsletter is sent out. Test email works 100%.

Does the newsletter work with Jellyfin Server for Windows?

@mastamjay Newsletter should work as long as jellyfin does, yeah. I looked at your logs but don't see anything helpful. Can you turn on debug mode in the plugin settings and try again, then share those logs?

mastamjay commented 1 month ago

Jellyfin 10.9.3 run okay. only the newsletter Plugin doesn't work

Switch on debug mode here is the newsletter log file after filesystem scraping Newsletter Log file.txt

Cloud9Developer commented 1 month ago

@mastamjay , is that the whole logfile? It only shows an 1 error and then nothing after. It should continue past that 1 error (error processing file) and continue scanning

mastamjay commented 1 month ago

@mastamjay , is that the whole logfile? It only shows an 1 error and then nothing after. It should continue past that 1 error (error processing file) and continue scanning sry. I had only copied a part from the log. Here is the whole Full Newsletter Log.txt

mastamjay commented 1 month ago

FYI: With Jellyfin 10.8.x and the newsletter plugin v.0.6.0. everything worked fine so far. I think that with version 0.6.4.2, the new media is not recognised and not made available for the email, on windows systems.

nylimited commented 1 month ago

Somehow I suspect there is more going on with the JF 10.0.x changes. I run this plugin and Ombi side by side, generating 2 newsletters. Ombi has not been updated toward the new JF. The Ombi newsletter included a few very old media and the plugin newsletter dropped a new one or two. I don't know why but there is a lot more debugging needed than meets the eye. 🫒

Cloud9Developer commented 1 month ago

What's throwing me for a loop is that it's only scanning one item then stopping. @mastamjay , are you clicking scan multiple times (starting it then stopping it)?

mastamjay commented 1 month ago

What's throwing me for a loop is that it's only scanning one item then stopping. @mastamjay , are you clicking scan multiple times (starting it then stopping it)? No, I just click Filesystem Scraper once under Scheduled Tasks. I then wait for the process to complete, which takes a maximum of 5 seconds. Then I wait another 10 seconds and click on Email Newsletter.

mastamjay commented 1 month ago

Should I completely uninstall the newsletter plugin from jellyfin and also some files/folders of the plugin under Windows? If so, which folders and files of the plugin should I delete under Windows? Then I could test another version. Or is it enough to choose another version or plugin/catalogue and install it?

Cloud9Developer commented 1 month ago

@mastamjay , can you try to do a full rescan and see what happens there? make a backup of your newsletters.db file in your /config directory, then delete the existing newsletters.db file. Then run the scan and email tasks

nylimited commented 1 month ago

Should the scraper run only once before the newsletter is created? I kind of assumed (yes, I know about assume ..) that I can run it daily, accumulate new items and when the newsletter runs it sets everything "read" so to speak. At the moment the newsletter runs only once a week (on Fridays) but the file system scraper runs daily. Since I have not pushed any new media to the system yet I can easily make adjustments.

Cloud9Developer commented 1 month ago

@nylimited the scrapper is defaulted to run every 2 hours (configurable via the scheduled task). This is to catch any media added throughout the week, and to save on processing power since it skips the heavy processing of media already scanned.

there's 3 tables in the db:

The scrapper checks if the current scan item exist any tables currently and, if it doesn't, writes it to CurrRunData and clones everything there into CurrNewsletterData after processing is complete.

The email task reads from CurrNewsletterData to generate and process all items for the current cycle, build the HTML for the email, sends it out, then copies everything over to ArchiveData.

mastamjay commented 1 month ago

@mastamjay , can you try to do a full rescan and see what happens there? make a backup of your newsletters.db file in your /config directory, then delete the existing newsletters.db file. Then run the scan and email tasks the file β€˜newsletter.db is located in C:\ProgramData\Jellyfin\Server\data I have deleted it. New full Newsletter log.txt

mastamjay commented 1 month ago

I have noticed that the Newsletter.db file is only 28kb in size. The 0.6.0 file is over 1MB and contains the scraped data. I looked at it using Windows Notepad.

Cloud9Developer commented 1 month ago

Think I have an idea on what's happening. It's crashing when trying to get the BaseItems (jellyfin items).

What's your file structure look like?

mastamjay commented 1 month ago

Think I have an idea on what's happening. It's crashing when trying to get the BaseItems (jellyfin items).

What's your file structure look like?

What exactly do you mean by file structure?

Cloud9Developer commented 1 month ago
β”œβ”€β”€ Series (2010)
β”‚   β”œβ”€β”€ Season 00
β”‚   β”‚   β”œβ”€β”€ Some Special.mkv
β”‚   β”‚   β”œβ”€β”€ Episode S00E01.mkv
β”‚   β”‚   └── Episode S00E02.mkv
β”‚   β”œβ”€β”€ Season 01
β”‚   β”‚   β”œβ”€β”€ Episode S01E01-E02.mkv
β”‚   β”‚   β”œβ”€β”€ Episode S01E03.mkv
β”‚   β”‚   └── Episode S01E04.mkv
β”‚   └── Season 02
β”‚       β”œβ”€β”€ Episode S02E01.mkv
β”‚       β”œβ”€β”€ Episode S02E02.mkv
β”‚       β”œβ”€β”€ Episode S02E03 Part 1.mkv
β”‚       └── Episode S02E03 Part 2.mkv

are you following this format with your media structure on your filesystem?

mastamjay commented 1 month ago

Yes, just with the name of the series before that and in German: Example: English wording Series -> 3 Body Problem -> Season 1 | 3 Body Problem - S01E01- Countdown.mkv German wording Serien -> 3 Body Problem -> Staffel 1 | 3 Body Problem - S01E01- Countdown.mkv

should actually be okay: After all, it worked without any problems before. https://jellyfin.org/docs/general/server/media/shows

Cloud9Developer commented 1 month ago

so it's /series/3 Body Problem/Season 1/3 Body Problem - S01E01- Countdown.mkv Correct?

mastamjay commented 1 month ago

so it's /series/3 Body Problem/Season 1/3 Body Problem - S01E01- Countdown.mkv Correct?

Yes

Cloud9Developer commented 1 month ago

hmm.. Well, there goes that idea..

Cloud9Developer commented 1 month ago

see, here's your logs:

[NLP]: [2024-06-04] :: [12:25:47] - [INFO] Parsing Series..
[NLP]: [2024-06-04] :: [12:25:47] - [INFO] Scan Size: 12080
[NLP]: [2024-06-04] :: [12:25:47] - [INFO] Scanning 'Series'
[NLP]: [2024-06-04] :: [12:25:47] - [ERR] An error has occured: System.IndexOutOfRangeException: Index was outside the bounds of the array.

But there should be another line in there, like this (at the very least):

[NLP]: [2024-06-04] :: [12:25:47] - [INFO] Parsing Series..
[NLP]: [2024-06-04] :: [12:25:47] - [INFO] Scan Size: 12080
[NLP]: [2024-06-04] :: [12:25:47] - [INFO] Scanning 'Series'
[NLP]: [2024-06-04] :: [12:25:47] - ---------------
[NLP]: [2024-06-04] :: [12:25:47] - [ERR] An error has occured: System.IndexOutOfRangeException: Index was outside the bounds of the array.

Which tells me that it's crashing when doing this foreach in the code:

logger.Info($"Scanning '{type}'");
        foreach (BaseItem item in items)
        {

But i'm not sure why if you're file structure is following the recommendation...

mastamjay commented 1 month ago

could this have something to do with the german translation?

Cloud9Developer commented 1 month ago

Hmm, maybe? could be some special character that it's not liking

mastamjay commented 1 month ago

Should I completely uninstall the newsletter plugin from jellyfin and also some files/folders of the plugin under Windows? If so, which folders and files of the plugin should I delete under Windows? Then I could test another version. Or is it enough to choose another version or plugin/catalogue and install it?

Should I try this out

Cloud9Developer commented 1 month ago

You can attempt it, but I doubt it would do anything except cause you headache having to reconfigure everything again

Cloud9Developer commented 1 month ago

Anyway you can swap to english translation to see if that's actually the issue? If it works, we know it's due to translation. If not, then more thought needs to be put into what's going on lol

mastamjay commented 1 month ago

first of all, thank you very much for your help. I will make a few attempts to get the plugin running again.

Cloud9Developer commented 1 month ago

My pleasure! I may be slow to respond or unresponsive at times due to work (@nylimited knows, he got annoyed at me a while back ;) lol) but I want to make sure it's working for as many people that I can

nylimited commented 1 month ago

My pleasure! I may be slow to respond or unresponsive at times due to work (@nylimited knows, he got annoyed at me a while back ;) lol) but I want to make sure it's working for as many people that I can

I heard that work is a four lettered word .... 🀣 (Of course being a retired IT director lets me make fun of work)

mastamjay commented 1 month ago

Update: got it running again.

  1. What I did:
  2. Windows 11 + Jellyfin Server 10.9.3
  3. Newsletter Plugin v 0.6.2.1
  4. Newsletter.db deleted in advance
  5. then clicked on Filesystem Scraper (took longer because the whole library was captured)
  6. Email sent -> works

However, among other things, the ratings and running times are not displayed correctly.

grafik grafik

I also have a question as to whether I have used the modern templates for body and entry correctly

Body HTML:

<html>
<body>
    <div>
        <table style="margin-left: auto; margin-right: auto; font-family:'Google Sans',Arial,sans-serif;">
            <tr> 
                <td width="100%" height="100%" style="vertical-align: top; background-color: #000000;"> 
                    <table id="InsertHere" name="MainTable" style="margin-left: auto; margin-right: auto; border-spacing: 0 10px; padding: 0 10px;"> 
                        <tr style="text-align: center;"> 
                            <td colspan="2"> 
                                <h1 id="Title" style="font-size:3.3em;margin:10px 0 0 0;">
                                    <a href="{ServerURL}" target="_blank" style="color:#E197BC;text-decoration: none;">
                                        <img src="https://cdn0.iconfinder.com/data/icons/google-material-design-3-0/48/ic_play_circle_filled_white_48px-512.png" style="height: 1.3em;margin-bottom:-12px;"> 
                                        Jellyfin Newsletter
                                    </a>
                                </h1>
                                <h3 id="Date" style="color:#FFFFFF;margin:0px;">{Date}</h3>
                            </td> 
                        </tr>
                        <tr>
                            <!-- Fill this in from code -->
                            {EntryData}
                            <!-- Fill that in from code -->
                        </tr>
                    </table> 
                </td>
            </tr> 
        </table> 
    </div>
</body>
</html>

Entrydata HTML:

                                            <table>
                                                <td>
                                                    <div id="runtime" style="color: #d190c5; font-size: small;">
                                                        <b>Duration:</b> <i>{RunTime} min.</i> |
                                                    </div>
                                                </td>
                                                <td>
                                                    <div id="communityrating" style="color: #d190c5; font-size: small;">
                                                        <img src="https://cdn-icons-png.flaticon.com/512/3418/3418886.png" style="height: 15px;"> 
                                                    </div>
                                                </td>
                                                <td>
                                                    <div id="communityrating" style="color: #d190c5; font-size: small;">
                                                        {CommunityRating} |
                                                    </div>
                                                </td>
                                                <td>
                                                    <div id="officialrating" style="color: #d190c5; font-size: small;">
                                                        {OfficialRating} |
                                                    </div>
                                                </td>
                                                <td>
                                                    <div id="premiereyear" style="color: #d190c5; font-size: small;">
                                                        {PremiereYear}
                                                    </div>
                                                </td>
                                            </table>

                                            <!--  -->

                                            <div class="text" style="color: #d190c5;">
                                                {SeasonEpsInfo}
                                            </div>
                                            <hr style="border-color: #007fb1;margin-bottom:12px;width:80%;"/> 
                                            <div id="Description" class="text" style="color: #FFFFFF;">
                                                {SeriesOverview}
                                            </div>
                                        </td>
                                    </tr>
                                </table>
                            </td>
                        </tr>
                        <!-- Fill that in from code -->
p37307 commented 1 month ago

Not sure if this is what is going on with you, but I looked in the config file jellyfin\plugins\configurations\Jellyfin.Plugin.Newsletters.xml for Windows 10 and had to change <NewsletterDir> path from \cache\temp/Newsletters/ to \cache\temp\Newsletters\ and manually created the Newsletters folder. It worked after that.

@p37307 Ahh, looks like unix paths and windows don't mesh.. Can you open an issue for this? I'll see if I can find a way to get that fixed

@Cloud9Developer Sure will. It'll be a little bit later this evening.

Cloud9Developer commented 1 month ago

@nylimited πŸ˜‚

@mastamjay , ratings and runtime were added in v0.6.2.2 I believe, so they wouldn't be available. As for what you have, yeah looks correct (other than the not-yet-supported tags in that version you are using)

mastamjay commented 1 month ago

I have now tested all versions above 0.6.2.1 and have to realise that something has changed since 0.6.3.0 that is not compatible with Jellyfin Server for Windows.

Cloud9Developer commented 1 month ago

0.6.3.0 was the release that updated support for jellyfin 10.9.0

mastamjay commented 1 month ago

was what I could do:

  • Switching from German to English
  • I tried switching a series and a film from German to English. without success. It could also be due to jellyfin itself, but I am technically rather reluctant to update.

Just wanted to let you know.

Cloud9Developer commented 1 month ago

What version of jellyfin are you on?

mastamjay commented 1 month ago

What version of jellyfin are you on?

10.9.3

Cloud9Developer commented 1 month ago

gotcha. Yeah, I'm not sure what the problem is. Probably something to do with the versioning compatibility with windows server like you said, but I can't say for sure..

mastamjay commented 1 month ago

Thanks for the work on your newsletter plugin. Can't wait to see what else is coming. Can I buy you a coffee?

nylimited commented 2 weeks ago

Today's sample for you (attached) .. Missed one TV show and associated picture. Okay, missed all data except the fact that something should have been there.

newsletter.zip And, yes, separating movies and TV and music is becoming kinda important ...