jansmolders86 / mediacenterjs

A HTML/CSS/Javascript (NodeJS) based Media center
http://mediacenterjs.com
1.29k stars 243 forks source link

TV shows do not display #103

Closed awafaa-zz closed 10 years ago

awafaa-zz commented 10 years ago

Doing a test, I have two TV episodes from the same show in a directory. Unfortunately nothing is displayed apart from "LOADING, PLEASE WAIT".

There are no errors displayed in the logs:

info: socket.io started
MediacenterJS listening on port:3000

Current version up to date.
Found 1 shows, getting additional data...

If I reload the page, the last line is repeated but still nothing is displayed.

jansmolders86 commented 10 years ago

Hej Andrew,

Thank you for your continued tests. I found that on Linux, the view only gets updated if there is more than one show available. If you add one show, things should work. I'm refactoring the music metadata atm and will incorporate the improvements in the tv scraper to fix this bug.

Thanks again!

jansmolders86 commented 10 years ago

Does this issue still occur after the latest scraper changes? I'm having some trouble recreating this issue on Windows and Ubuntu.

awafaa-zz commented 10 years ago

Hi Jan,

It still affects me on openSUSE. With TV shows all I get is:

Found 1 shows, getting additional data...
Database error: Error: near line 4: no such table: tvepisodes

Screen ready...

On my test machine I only have two shows each with one episode. Nothing shows up in the display.

awafaa-zz commented 10 years ago

Oh and the error line number changes with each refresh too.

jansmolders86 commented 10 years ago

Thanks for checking Andrew, I'll hook up a virtualbox with opensuse to replicate the exact conditions to finally fix this thing.

vprimachenko commented 10 years ago

same on windows with music

Getting album data
Looking for stored albums.
Screen ready...
Found albums...
Found 80 albums, getting additional data...
jansmolders86 commented 10 years ago

I found this solution but I have to refactor some code a bit. Thanks to you both for sticking with me on this. It really means a lot. When I'm done I'll let you guys know!

jansmolders86 commented 10 years ago

Hej Andrew and vprimachenko,

Would you guys be so kind and test again? I just rewrote a very large portion of the code concerning metadata. I've pushed the changes to the master branch.

Thanks again for all your help!

Jan

awafaa-zz commented 10 years ago

Hi Jan,

I've just tried again, and got the following error after clearing db and device cache:

Current version up to date.
DB error [Error: Error: near line 6: no such table: tvshows
]

/home/andrew/Code/mediacenterjs/apps/tv/tv-functions.js:111
        if (typeof rows !== 'undefined' && rows.length){
                                               ^
TypeError: Cannot read property 'length' of null
    at EventEmitter.<anonymous> (/home/andrew/Code/mediacenterjs/apps/tv/tv-functions.js:111:48)
    at Socket.onerror (/home/andrew/Code/mediacenterjs/node_modules/dblite/build/dblite.node.js:225:16)
    at Socket.EventEmitter.emit (events.js:95:17)
    at Socket.<anonymous> (_stream_readable.js:746:14)
    at Socket.EventEmitter.emit (events.js:92:17)
    at emitReadable_ (_stream_readable.js:408:10)
    at emitReadable (_stream_readable.js:404:5)
    at readableAddChunk (_stream_readable.js:165:9)
    at Socket.Readable.push (_stream_readable.js:127:10)
    at Pipe.onread (net.js:528:21)
Child process exited
jansmolders86 commented 10 years ago

Argh, I messed up! I'll fix it in a couple of hours. Sorry for this. The problem is SQL is more 'picky' on Linux then on Windows so some errors are only presented on Linux. I'll fix that error later today and everything should work as intended! Thanks again!

awafaa-zz commented 10 years ago

No problem, thanks for all your hard work!

jansmolders86 commented 10 years ago

Hej Andrew, I fixed my mistake from earlier today. I haven't tested it though because I was too busy I'm afraid. Hopefully you will have better results now nonetheless :)

awafaa-zz commented 10 years ago

Hi Jan,

Unfortunately doesn't look like I have much luck:

Current version up to date.
DB error [Error: Error: near line 2: no such table: tvshows
]

module.js:340
    throw err;
          ^

Error: Cannot find module 'graceful-fs'
    at Function.Module._resolveFilename (module.js:338:15)
    at Function.Module._load (module.js:280:25)
    at Module.require (module.js:364:17)
    at require (module.js:380:17)
    at Object.<anonymous> (/home/andrew/Code/mediacenterjs/lib/utils/metadata/tv-metadata.js:21:10)
    at Module._compile (module.js:456:26)
    at Object.Module._extensions..js (module.js:474:10)
    at Module.load (module.js:356:32)
    at Function.Module._load (module.js:312:12)
    at Function.Module.runMain (module.js:497:10)

Metadata fetching for tv complete...
Child process exited for:  tv
Metadata fetcher error:  { [Error: Command failed: 
module.js:340
    throw err;
          ^
Error: Cannot find module 'graceful-fs'
    at Function.Module._resolveFilename (module.js:338:15)
    at Function.Module._load (module.js:280:25)
    at Module.require (module.js:364:17)
    at require (module.js:380:17)
    at Object.<anonymous> (/home/andrew/Code/mediacenterjs/lib/utils/metadata/tv-metadata.js:21:10)
    at Module._compile (module.js:456:26)
    at Object.Module._extensions..js (module.js:474:10)
    at Module.load (module.js:356:32)
    at Function.Module._load (module.js:312:12)
    at Function.Module.runMain (module.js:497:10)
] killed: false, code: 8, signal: null }

module.js:340

    throw err;

   ^

Error: Cannot find module 'graceful-fs'
    at Function.Module._resolveFilename (module.js:338:15)
    at Function.Module._load (module.js:280:25)
    at Module.require (module.js:364:17)
    at require (module.js:380:17)
    at Object.<anonymous> (/home/andrew/Code/mediacenterjs/lib/utils/metadata/tv-metadata.js:21:10)
    at Module._compile (module.js:456:26)
    at Object.Module._extensions..js (module.js:474:10)
    at Module.load (module.js:356:32)
    at Function.Module._load (module.js:312:12)
    at Function.Module.runMain (module.js:497:10)

Metadata fetching for tv complete...
Child process exited for:  tv
Metadata fetcher error:  { [Error: Command failed: 
module.js:340
    throw err;
          ^
Error: Cannot find module 'graceful-fs'
    at Function.Module._resolveFilename (module.js:338:15)
    at Function.Module._load (module.js:280:25)
    at Module.require (module.js:364:17)
    at require (module.js:380:17)
    at Object.<anonymous> (/home/andrew/Code/mediacenterjs/lib/utils/metadata/tv-metadata.js:21:10)
    at Module._compile (module.js:456:26)
    at Object.Module._extensions..js (module.js:474:10)
    at Module.load (module.js:356:32)
    at Function.Module._load (module.js:312:12)
    at Function.Module.runMain (module.js:497:10)
] killed: false, code: 8, signal: null }
jansmolders86 commented 10 years ago

Finally an error I had nothing to do with :)

You need to do a NPM install because you do not have the gaceful-fs module installed yet. (it's a new dependency)

From the root of MediacenterJs simply typ: npm install graceful-fs Or just run "npm install" since it is marked as a dependency in the package json

awafaa-zz commented 10 years ago

Ah, didn't realise the new dependency! OK after npm install, it now actually starts to do something although I still can't get any shows up to watch:

MediacenterJS listening on port:3000

DB error [Error: Error: near line 2: no such table: tvshows
]
Starting scan for 3 files

Database error: Error: near line 1: database is locked
Error: near line 2: database is locked

Starting scan for 3 files

Database error: Error: near line 3: database is locked

Item 1 from 3, 33% done 

Database error: Error: near line 5: database is locked

Item 1 from 3, 33% done 

Current version up to date.
awafaa-zz commented 10 years ago

Hmm, with the fixes you been doing for TV shows it may have had an adverse affect on Movies:

MediacenterJS listening on port:3000

DB error [Error: Error: near line 1: no such table: movies
]

/home/andrew/Code/mediacenterjs/apps/movies/movie-functions.js:168
        if (typeof rows !== 'undefined' && rows.length > 0){
                                               ^
TypeError: Cannot read property 'length' of null
    at EventEmitter.<anonymous> (/home/andrew/Code/mediacenterjs/apps/movies/movie-functions.js:168:48)
    at Socket.onerror (/home/andrew/Code/mediacenterjs/node_modules/dblite/build/dblite.node.js:225:16)
    at Socket.EventEmitter.emit (events.js:95:17)
    at Socket.<anonymous> (_stream_readable.js:746:14)
    at Socket.EventEmitter.emit (events.js:92:17)
    at emitReadable_ (_stream_readable.js:408:10)
    at emitReadable (_stream_readable.js:404:5)
    at readableAddChunk (_stream_readable.js:165:9)
    at Socket.Readable.push (_stream_readable.js:127:10)
    at Pipe.onread (net.js:528:21)
jansmolders86 commented 10 years ago

Luckily I pushed a fix for this! :) Sadly though I've been getting the database locked problem as well. Again only on Linux strangely enough.

As you can see in the attachment, Windows works just fine (although the logging feedback is still a bit iffy) getting three simpons episodes works as expected:

2014-05-29 22_24_33-c__windows_system32_cmd exe

This db locked thing is the only thing still in the way of proper metadata fetching in Linux. Once fixed we can finally put this thing to bed I hope! Tomorrow I'll try to fix the db locked issue!

TheKnarf commented 10 years ago

I have the exact same problem on Mac.

jansmolders86 commented 10 years ago

I believe i have finally fixed this issue. Would you please delete your database in /lib/database, pull the latest version and try again?

awafaa-zz commented 10 years ago

Hi Jan,

Impressive work. Unfortunately I seem to have issues with anything displaying.

Current version up to date.
Getting tv data
Screen ready...
33% done.
66% done.
100% done.
Found 3 shows, getting additional data...
Error retrieving episodes
Error retrieving episodes
Error retrieving episodes

Is there a way of getting better debug info? Movies displays correctly, and quickly.

jansmolders86 commented 10 years ago

Thank you very much Andrew! It means a lot! After refreshing do the tvshows show up? I added additional logging. I'm curious what is happening!

jansmolders86 commented 10 years ago

Doh! I already know what the issue is! Your episode arn't formatted in a way the tv app currently understands. It only understands episodes with SXXEXX formatting. (eg the simpsons s02e12). Of course this will be expanded in the future. Am I correct ?

I've tweaked the code to return even if the episodes can not be found correctly. If for instance only one show does not meet the requirements, the other shows are shown anyway :)

awafaa-zz commented 10 years ago

Unfortunately they are formatted correctly:

ls ~/Videos/TV/
Burn Notice S06E16.mp4  NCIS Los Angeles S05E01.mp4  Sherlock S03E01.mp4

The error I have is:

Screen ready...
Current version up to date.
Getting tv data
Screen ready...
33% done.
66% done.
100% done.
Found 3 shows, getting additional data...
Error retrieving episodes. Available episodes: none
Error retrieving episodes. Available episodes: none
Error retrieving episodes. Available episodes: none
jansmolders86 commented 10 years ago

Thanks for giving me the filenames Andrew.I will try reproduce the problem so I can fix it!

jansmolders86 commented 10 years ago

Hej Andrew,

I believe it works now. I can get the show data just fine now and see them presented on the screen.

image

I do still have some issues with the NCIs show. I think it's because it has a ":" which needs to be espaced. But I have to look into that.

would you mind testing it?

TheSisb commented 10 years ago

I wrote a comment here yesterday but it is gone now for some reason, did you see it?

It went something like this (from memory):

Hey @jansmolders86 Loving the progress on this project! Are you planning to add a method to customize the regex for the scraper yet? I have a slightly different naming convention for my media content. I would love to be able to customize how the scraper finds and organizes the files in the settings page (straight regex or otherwise).

Using the Burn Notice example from above, my file naming structure looks like this

ls ~/Videos/TV/Burn Notice/
Burn Notice - 6x16 - title.mp4

That slight difference is making the whole application unusable and I feel it would be easier to modify the scraper's pattern matching algo than to rename my entire media library.

Also I wouldn't mind creating the modification myself if you could just direct me to where in the code this work is happening.

Thanks!

_[edit]_ Sorry, I see you still have it on the wishlist here https://trello.com/c/g3TzigYC/79-allow-users-to-specify-the-file-name-structure-like-how-sick-beard-does-it-http-puu-sh-8semg-6305c1107d-png

Maybe I can submit a pull request for this if you could just tell me where the scraping happens and any ideas of how you'd like it to be done.

jansmolders86 commented 10 years ago

Hey there @TheSisb ,

Weird your comment got deleted. It showed up on my timeline, but the comment itself was gone. I would more than welcome any help! I agree the pattern should be customizable. But have not implemented it yet.

So a couple of files are important for you to check out:

As you can see in the scraper, the handling of tv show season and episode data is static and lacking to say the least, due to the fact the tv app has gotten the least attention from me tbh.

Maybe it would be cool to present a select box in the settings panel with say 4 common conventions to keep it usable and understandable for all users. What do you think?

jansmolders86 commented 10 years ago

So I'm closing this issue for now. I have added a trello ticket for the issue @TheSisb described and will tackle that shortly!