Jump to content

huddy

New Members
  • Posts

    6
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

huddy's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. Hi All, I'm hoping you're able to help me with something, I need some regex to match EP01, E01 but to not match anything if it's anything it has s01, for example s01e01 which it currently does. Here's what I've got: /ep?(\d\d)/i Thanks for any help. Billy
  2. Hi Ignace I'm sort of going with a single responsibility theme, so this library is only responsible for the matching the episode/season, so by adding more responsibility I would be going away from this?. Maybe adding adapters for different types of data isn't going away from that theory? I want it to be loosely coupled, so they can be used in other projects without any modification, it's also worth noting that this library can match strings weather they be from a filename or some other source. Given that, would you still say parsing directory/string adapter objects through? I do sort of like the idea of it Cheers Billy
  3. You could ask a question, or use recapture: http://www.google.com/recaptcha, or use both. This should help you, I'd recommend using both a question and recaptcha in combination to increase security. Billy
  4. Hi All So I wrote this library last night regarding this subject: https://github.com/huddy/tvfilename It would be great to get some feedback on my code. Billy
  5. Hi Scootstah, Thanks for your time I agree that the regex for some of them is quite easy, but the list provided isn't all of the actual formats you see, I think my question is more about how you deal with matching or parsing such a wide variety of formats in a nice, maintainable & reliable way. I could just put lots of regex patterns in an array and loop through them and run them against a file name to see if they match then have lots of if statements or a switch statement, but I think this will become quite complicated as you start matching 20+ formats, especially if you need more logic surrounding them, take the EP01 as an example, it could be there's only one season, so you could call out an API and check how many seasons the show had, if it's only 1, then assume it's season 1. I might be wrong, and as always willing to be proved wrong. Thanks! Billy
  6. Hi All I'm after some advice about how to write a parser to match many different naming formats of a tv episode, so the one thing we can rely on is that a episodes are inside a folder named after the show, for example "House MD\episode name. s1e07.mkv" so we know the show name, that part is easy, the bit I need to match is the season and episode number. The format of the file name can differ is so many ways, here are some examples: - S01E01 - s1e10 - S3e6 - 105 (for season 1, episode 5) - EP01 (usually there's one season in this case, but not 100% of the time) So as you can see there are a few variations, almost always the show name is in there too, and sometimes they contain resolution, so: House.MD S1E09 720p HD.mkv, there are many combinations but since we already know the show name it's not something I think we need to worry *too* much about. My question relations to how you would approach this? You can see from the examples above sometimes this would be hard to match and work out. My initial idea would be to have a class called 'tvmatcher', or something, which has match handlers, one match handler for each format we need match, a handler would be a class that extends tvmatcher and have the same method, like $handler->match($string); the first one to match would be the winner. This could be extended to sanity check the result and ensure that the season/ep actually exists. I really don't know how to go about this, the idea above is my best so far, so again my questions really are: How would you approach this? Is there a pattern that would help? any other ideas about how this could be acheived? It's worth noting that I'd be using external APIs to get show information, but would be out of the scope of this library, but could help with said sanity checks. Cheers, Billy
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.