Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Scan filesystem #19

Open
KenavR opened this issue Oct 16, 2017 · 4 comments
Open

Scan filesystem #19

KenavR opened this issue Oct 16, 2017 · 4 comments

Comments

@KenavR
Copy link
Member

KenavR commented Oct 16, 2017

Write a function that accepts a file path and a list of extensions as a parameter and returns a list of found video files including additional information which can be extracted from the Filesystem.

e.g.

findVideoFiles(\\nas1\\series’, [‘avi’, ‘mp4’]);
{
  filepath: "\\nas1\\series\\south_park\\season_1\\sp_s1_e1.mp4"
  series: "South Park",
  season: 1,
  episode: 1
},
...

We should also research if we can extract additional information from the video file itself. Requiring a specific file structure may be a problem for users.

@ozgunbal
Copy link
Contributor

I think, there are two option for structure for correct parsing:

  • Folder structure: /series_name/season_number/episode.mp4
  • File name structure: [seriesName]_S[seasonNumber]E[episodeNumber].mp4 (e.g: GameOfThrones_S07E01.mp4)

I'm suggesting second one. If there'll be an agreement on this, i will try to implement.

@KenavR
Copy link
Member Author

KenavR commented Nov 22, 2017

Just thought about it a little bit more and I believe there are some other valid approaches we could take to make it as easy as possible for the user, but it depends on how complicated we what to make the implementation.

We could load/add a list of series and let the user add a name, to cover both of your scenarios. We could also let the user choose the/a pattern (the two you suggested or something else). Weirdly enough for when I worked on something similar I structure my library to fit both patterns.

@ozgunbal
Copy link
Contributor

I tried few things and reach this far:

  • Using findVideoFiles(folderPath, extensions) function and listing all files with given extensions and recursive folder checking. Output is promise of full paths' array like ['path/to/be/southpark/season1/1.mp4', ...]
  • So we can change the pattern with only differ the regex
  • I did this with native Promises (promisifying sum functions), if we'll go with ES5, it can be messy. But, alternatively, well-tested npm module can be used.

If it's okay for you, maybe i would make a PR and then talk on it.

@KenavR
Copy link
Member Author

KenavR commented Nov 23, 2017

ES6/7 (whatever works in the current version of node) is fine. For further discussion, a PR would be great.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants