A movie Renamer

Hello Guys,

I am trying to develop "A movie renamer" in ruby and wanted to get some
ideas on Object oriented design, this is my first time with an Object
Oriented language so it would really help me if somebody would help me
design my application. The kind of things which I want to accomplish are:

- Renaming movie files in a directory from a format like
"The.Passion.Of.The.Christ.2004.UNCUT.720p.BRRip.x264.AC3.dxva-HDLiTE" to a
Good looking movie name "The Passion of the Christ"
- If this goes well then would like to add year also along with the movie
name.

Couple of things which I want to achieve by developing this is to understand
TDD(so yes I want to write tests for my application), Object Oriented
design. It would be great if somebody can mentor me also in my pet project.

···

--
Mayank Kohaley

Hello Guys,

I am trying to develop "A movie renamer" in ruby and wanted to get some
ideas on Object oriented design, this is my first time with an Object
Oriented language so it would really help me if somebody would help me
design my application. The kind of things which I want to accomplish are:

- Renaming movie files in a directory from a format like
"The.Passion.Of.The.Christ.2004.UNCUT.720p.BRRip.x264.AC3.dxva-HDLiTE" to a
Good looking movie name "The Passion of the Christ"
- If this goes well then would like to add year also along with the movie
name.

Piracy is bad. Don't do piracy. mmmkay?

As for your answer. look to the file class in core.

http://www.ruby-doc.org/core/classes/File.html
http://www.ruby-doc.org/core/classes/Dir.html

Also, shameless plug here, check out tryruby.org
I have a lesson in there that runs through using the basics of dir.
Granted, in my example I am using fakefs under the hood-- for security
purposes.

Couple of things which I want to achieve by developing this is to
understand
TDD(so yes I want to write tests for my application), Object Oriented
design. It would be great if somebody can mentor me also in my pet project.

You may want to start off with test unit. See if you can get a hold of a

copy of ruby in practice. I like how they teach BDD/TDD. Also the defacto
BDD testing book is the RSpec Book.

Andrew McElroy

···

On Wed, Jun 29, 2011 at 10:37 AM, Mayank Kohaley <mayank.kohaley@gmail.com>wrote:

--
Mayank Kohaley

Please don't steal movies.

Sam

···

On 30/06/11 03:37, Mayank Kohaley wrote:

Hello Guys,

I am trying to develop "A movie renamer" in ruby and wanted to get some
ideas on Object oriented design, this is my first time with an Object
Oriented language so it would really help me if somebody would help me
design my application. The kind of things which I want to accomplish are:

- Renaming movie files in a directory from a format like
"The.Passion.Of.The.Christ.2004.UNCUT.720p.BRRip.x264.AC3.dxva-HDLiTE" to a
Good looking movie name "The Passion of the Christ"
- If this goes well then would like to add year also along with the movie
name.

Couple of things which I want to achieve by developing this is to understand
TDD(so yes I want to write tests for my application), Object Oriented
design. It would be great if somebody can mentor me also in my pet project.

Lets just not even go here, please.

···

On Wed, Jun 29, 2011 at 4:17 PM, Sam Duncan <sduncan@wetafx.co.nz> wrote:

Please don't steal movies.

Sam

1. Flickr Login

2. What makes you think (s)he's not just engaging in a little Fair Use?

3. Isn't this a little off-topic?

···

On Thu, Jun 30, 2011 at 06:17:55AM +0900, Sam Duncan wrote:

Please don't steal movies.

--
Chad Perrin [ original content licensed OWL: http://owl.apotheon.org ]

*sigh*

1. Your humorous image is ridiculous in the context, but I hope it helps you sleep at night.

2. Put that filename into your favourite search engine. If you already own it, you don't need the Internet.

3. That depends. Does the list have any rules about discussing (most likely) illegal activities?

The request could at least have used a fictional name, no? And then we wouldn't even be engaging in this discourse ...

Sam

···

On 30/06/11 09:30, Chad Perrin wrote:

On Thu, Jun 30, 2011 at 06:17:55AM +0900, Sam Duncan wrote:

Please don't steal movies.

1. http://tinyurl.com/3mapksl

2. What makes you think (s)he's not just engaging in a little Fair Use?

3. Isn't this a little off-topic?

I agree, lets leave the moral opinions out of it, this is a topic about how
to rename files and develop using certain methodologies.

(btw, the pig pic made me giggle)

···

On Wed, Jun 29, 2011 at 4:30 PM, Chad Perrin <code@apotheon.net> wrote:

3. Isn't this a little off-topic?

···

On Jun 29, 2011, at 11:39 PM, Sam Duncan wrote:

1. Your humorous image is ridiculous in the context, but I hope it helps you sleep at night.

Really didn't want to get into this, especially since it seems like everyone
is done...

*sigh*

1. Your humorous image is ridiculous in the context, but I hope it helps
you sleep at night.

Making a distinction between copyright infringement, piracy, and theft does
not mean you condone either, or participate in either.

As the image says, theft removes the original.
Copyright infringement just makes a copy.

And for what it's worth, regardless of what the humorous image says, copyright
infringement isn't piracy. Piracy is armed robbery on the high seas.

I'm not arguing that any of these things are OK, but I really wish people
would keep some perspective.

I do agree with this, though:

3. That depends. Does the list have any rules about discussing (most
likely) illegal activities?

It's not the legality that bothers me so much as the ethics, but either are
worth at least mentioning in situations like this. Another place this is done
is with homework questions -- someone will point out that something looks like
a homework question. I don't always notice something wrong with the question
itself, so I'm glad when people point it out, because I don't want to help
with homework questions.

Maybe other people feel the same way about "stealing" movies -- you might not
have noticed from the filename itself, but now that someone mentioned it, you
don't want to help with that.

But I don't know. It's a slippery slope.
We wouldn't want ruby-talk to become morality-talk.

···

On Wednesday, June 29, 2011 04:39:32 PM Sam Duncan wrote:

Before this goes completely off the rails [sic], my points are;

*) Call the thread "A File Renamer"
*) Make up an example filename
*) Profit

Sam

···

On 30/06/11 10:06, Petite Abeille wrote:

On Jun 29, 2011, at 11:39 PM, Sam Duncan wrote:

1. Your humorous image is ridiculous in the context, but I hope it helps you sleep at night.

http://i.imgur.com/GxzeV.jpg

FWIW, I agree that this should be about ruby, not so much about morality or ethics. :slight_smile:

···

Sent from my BlackBerry device on the Rogers Wireless Network

-----Original Message-----
From: David Masover <ninja@slaphack.com>
Date: Thu, 30 Jun 2011 23:46:36
To: ruby-talk ML<ruby-talk@ruby-lang.org>
Reply-To: ruby-talk@ruby-lang.org
Subject: Re: A movie Renamer

Really didn't want to get into this, especially since it seems like everyone
is done...

On Wednesday, June 29, 2011 04:39:32 PM Sam Duncan wrote:

*sigh*

1. Your humorous image is ridiculous in the context, but I hope it helps
you sleep at night.

Making a distinction between copyright infringement, piracy, and theft does
not mean you condone either, or participate in either.

As the image says, theft removes the original.
Copyright infringement just makes a copy.

And for what it's worth, regardless of what the humorous image says, copyright
infringement isn't piracy. Piracy is armed robbery on the high seas.

I'm not arguing that any of these things are OK, but I really wish people
would keep some perspective.

I do agree with this, though:

3. That depends. Does the list have any rules about discussing (most
likely) illegal activities?

It's not the legality that bothers me so much as the ethics, but either are
worth at least mentioning in situations like this. Another place this is done
is with homework questions -- someone will point out that something looks like
a homework question. I don't always notice something wrong with the question
itself, so I'm glad when people point it out, because I don't want to help
with homework questions.

Maybe other people feel the same way about "stealing" movies -- you might not
have noticed from the filename itself, but now that someone mentioned it, you
don't want to help with that.

But I don't know. It's a slippery slope.
We wouldn't want ruby-talk to become morality-talk.

And for what it's worth, regardless of what the humorous image says,
copyright
infringement isn't piracy. Piracy is armed robbery on the high seas.

lol

Another place this is done
is with homework questions -- someone will point out that something looks
like
a homework question. I don't always notice something wrong with the
question
itself, so I'm glad when people point it out, because I don't want to help
with homework questions.

I'm ambivalent about these cases.

I tend to think "the student knows better than I do what they need, I'll
just give them all the tools and let them choose for themselves so as to get
maximum benefit" but lately I wonder if people simply can't make good
decisions, even if they want to. In that case, maybe having the answer so
available causes them to choose the easy approach of just taking the answer
rather than the best approach of taking the piece of information they need
to be able to solve the problem.

Another place you see this is with troll feeding, people who mean well and
know what they need to do, but just can't bring themselves to do it. Same
thing, I think. In that case, I decided, that instead of trusting people to
learn enough to stop feeding the trolls, its best to just remove the trolls.
And similarly, instead of trusting people to not just copy a solution when
its not what they need, it may be best to just not provide the solution.

IDK, like I said, ambivalent.

···

On Thu, Jun 30, 2011 at 9:46 AM, David Masover <ninja@slaphack.com> wrote:

Before this goes completely off the rails [sic], my points are;

*) Call the thread "A File Renamer"
*) Make up an example filename
*) Profit

or this thread could just end because I answered it in the first email.
file.rename is the method he is looking for.

I linked to the file and the dir class documentation.

Andrew McElroy

···

On Wed, Jun 29, 2011 at 5:35 PM, Sam Duncan <sduncan@wetafx.co.nz> wrote:

Sam

On 30/06/11 10:06, Petite Abeille wrote:

On Jun 29, 2011, at 11:39 PM, Sam Duncan wrote:

1. Your humorous image is ridiculous in the context, but I hope it helps

you sleep at night.

http://i.imgur.com/GxzeV.jpg

Before this goes completely off the rails [sic], my points are;

No, wait -- this could be instructive for later threads:

*) Call the thread "A File Renamer"

. . . or you could have pretended that's what it's called, and none of
this would have happened.

*) Make up an example filename

. . . or you could consider that the person in question might have used
the same software to create a copy for personal use as whoever it was
that posted an illegal copy on the Internet, and not jump to conclusions,
thus potentially sparking an off-topic flamewar.

*) Profit

. . . or you could have contacted the person *personally* to tell him/her
your opinion of "stealing" (which isn't even the correct term) rather
than subject the rest of us to your self-righteousness.

I implore anyone else who considers taking the same approach as Sam
Duncan to consider my list of alternatives if any of you get the urge in
the future.

With that, I'm finished. Feel free to offer more declarations of moral
turpitude from on high if you like, Sam.

···

On Thu, Jun 30, 2011 at 07:35:03AM +0900, Sam Duncan wrote:

--
Chad Perrin [ original content licensed OWL: http://owl.apotheon.org ]

I actually have some ethical issues with this. If you're having this much
trouble with this sort of problem, you either need to learn fast, or you need
to not pass the course. Maybe giving some people all the answers will help
them learn fast, but it also might help them pass a course they shouldn't.

It's also kind of doing their work for them.

Also, if the course is at all decent, they have all sorts of other resources
available to them. If they're asking us and not their teacher (or TA), then
there's probably a reason for that, and it probably has to do with cheating.

If it's a larger project where asking mailing lists for help should be
allowed, then if they're at all competent, they're asking real questions, of
the sort professionals ask each other all the time. Those are also the sort of
question where answering it doesn't mean doing someone's work for them.

Still, it's been long enough since I've seen this discussed that I don't
really remember what an "obvious homework question" looks like, and how it
differs from a legitimate newbie question.

···

On Thursday, June 30, 2011 01:50:38 PM Josh Cheek wrote:

On Thu, Jun 30, 2011 at 9:46 AM, David Masover <ninja@slaphack.com> wrote:
> Another place this is done
> is with homework questions -- someone will point out that something looks
> like
> a homework question. I don't always notice something wrong with the
> question
> itself, so I'm glad when people point it out, because I don't want to
> help with homework questions.

I'm ambivalent about these cases.

I tend to think "the student knows better than I do what they need, I'll
just give them all the tools and let them choose for themselves so as to
get maximum benefit" but lately I wonder if people simply can't make good
decisions, even if they want to.

True enough. Add;

http://www.ruby-doc.org/core/classes/String.html
http://www.ruby-doc.org/core/classes/String.html#M001193
http://www.ruby-doc.org/core/classes/String.html#M001161

And maybe even;

http://www.ruby-doc.org/core-1.9/classes/Pathname.html

Sam

···

On 30/06/11 10:37, andrew mcelroy wrote:

or this thread could just end because I answered it in the first email.
file.rename is the method he is looking for.

  I linked to the file and the dir class documentation.

Andrew McElroy

I actually have some ethical issues with this. If you're having this much
trouble with this sort of problem, you either need to learn fast, or you
need
to not pass the course. Maybe giving some people all the answers will help
them learn fast, but it also might help them pass a course they shouldn't.

I honestly perceive this as "If someone needs help, that is evidence that
they don't deserve help."

It's also kind of doing their work for them.

Assuming the person is responsible, they are in a better place to decide if
that is what they need than we are.

Also, if the course is at all decent, they have all sorts of other
resources
available to them. If they're asking us and not their teacher (or TA), then
there's probably a reason for that, and it probably has to do with
cheating.

This is why learning is so hard. No one will help you, everyone thinks you
should suffer for knowledge.

···

On Fri, Jul 1, 2011 at 1:42 AM, David Masover <ninja@slaphack.com> wrote:

Still, it's been long enough since I've seen this discussed that I
don't really remember what an "obvious homework question" looks like,
and how it differs from a legitimate newbie question.

I saw one on a bidding website, the student had uploaded the problem as
a PDF. It had both the name of the University (I should have saved the
thing) and his professor's name on it.

I think it was $40 to implement a recursive descent parser in C for a
C-style language.

With the assumption that the op really wants to learn how to parse and alter
a string.

There is nothing wrong with leading a man to water. I don't think anyone
cares to do someones homework nor spoon-feed an answer. Linking to the
appropriate learning resource or documentation can easily weed out the lazy.
If the documentation is vague or overly terse then slowly breaking down the
problem to aid the op to a complete solution tends is a good route. If they
are still confused there is no need to have disdain towards their grasp of
the subject. With their persistence it will become obvious they really need
some specific attention. Showing someone how to create solutions for their
problems is the goal. Are we all not students and are we all not teachers?

~Stu

···

On Fri, Jul 1, 2011 at 1:42 AM, David Masover <ninja@slaphack.com> wrote:

I actually have some ethical issues with this. If you're having this much
trouble with this sort of problem, you either need to learn fast, or you
need
to not pass the course. Maybe giving some people all the answers will help
them learn fast, but it also might help them pass a course they shouldn't.

It's also kind of doing their work for them.

Maybe I'm thinking a bit amateurishly (only Rubying for a couple weeks now),
but wouldn't a regexp \w+ command for each filename suffice? Just return
everything before the . in the filename (guess you could avoid digits first)
and rewrite the file name with the return + ' '.

Guess you could add a raise exception if a movie was found pirated that
changes your username to 'THIEF'

···

On Wed, Jun 29, 2011 at 3:46 PM, Sam Duncan <sduncan@wetafx.co.nz> wrote:

True enough. Add;

http://www.ruby-doc.org/core/**classes/String.html&lt;http://www.ruby-doc.org/core/classes/String.html&gt;
http://www.ruby-doc.org/core/**classes/String.html#M001193&lt;http://www.ruby-doc.org/core/classes/String.html#M001193&gt;
http://www.ruby-doc.org/core/**classes/String.html#M001161&lt;http://www.ruby-doc.org/core/classes/String.html#M001161&gt;

And maybe even;

http://www.ruby-doc.org/core-**1.9/classes/Pathname.html&lt;http://www.ruby-doc.org/core-1.9/classes/Pathname.html&gt;

Sam

On 30/06/11 10:37, andrew mcelroy wrote:

or this thread could just end because I answered it in the first email.
file.rename is the method he is looking for.

I linked to the file and the dir class documentation.

Andrew McElroy