jansmolders86 / mediacenterjs

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

Check diskspace to ensure disk does not fill up with streams #70

Closed jansmolders86 closed 10 years ago

jansmolders86 commented 10 years ago

Using, https://github.com/keverw/diskspace.js, check the diskspace and if a certain quote is met, the oldest mp4 gets deleted.

Karnith commented 10 years ago

Hi Jan, my suggestion would be: rather than add an additional dependency to your application for stream purging, I would have either an external nfo file created or entry in the db that specifies the current running time of the stream. By doing this, you can automatically purge streams from storage on application restart, have a ui that clears streams (like a button) and purge streams that are x old.

My preference would be an nfo or some other file to hold the metadata of the current running stream. This would enable streams to be continued based on logged in user, if now or in the future, streams are to be tailored to individual users.

an example nfo could be:

<\user>\joe snow<\user>\ <\media>\ <\mediaTitle>\One Apon A Time<\mediaTitle>\ <\duration>\30:00<\duration>\ <\deviceProfile>\Samsung F series<\deviceProfile>\ <\container>\MKV<\container>\ <\transcode>\MP4<\transcode>\ <\audio>\AC3<\audio>\ <\video>\h.264<\video>\ <\currentTimeStamp>\15:45<\currentTimeStamp>\ <\lastViewed>\01-04-2014<\lastViewed>\ <\media>\

I added a few different nodes so that the file could be used to feed a generic ffmpeg command to start transcoding the stream from where the user left it. The device node would be important for DNLA streaming as not all devices support all codecs. This file could then be updated if the user want's to resume on a different device. So, media.device would dictate media.transcode, media.audio and media.video.

Make sense?

Karnith

PS: I had to escape the brackets with \, github didn't like the formatting and thought it was code.

jansmolders86 commented 10 years ago

This is amazing idea! This setup could fix so many issues I was having! I'm definitely going to implement this! Thank you so much.

The only thing I'm worried about is when using FFMPEG's -SS to jump to the currentTimeStamp it would give a weird progressbar for the end user as the file only seems as long as where currentTimeStamp sais it should start. (eg, runtime is 60 min, currentTimeStamp is 59 min,, this would result in a video only a minute long)

That is why I currenly just start the transcoding all over again if it did not finish and use the currentTimeStamp functionality to set the progress clientside. But this does not work for mobile devices,

I hope I've made any sense. I'd love yo hear your thoughts on this!

Karnith commented 10 years ago

this could be alleviated by providing a prompt to the user, something like the options resume and start over. Resume would take the ini/nfo files last position in the movie and start from there (if the file is already in the play/transcode folder it would start playing from the time stamp passed to it, otherwise it would start transcoding from the passed time stamp), start over would run a method to see if the file is already in the play/transcode folder (with full duration as the comparison) and play it (otherwise it would start transcoding it from the beginning)

jansmolders86 commented 10 years ago

I will close this issue and create a new one in Trello for the user prompt. Thanks Matthew!