Merge lp://staging/~renamer-developers/renamer/ditch-metalanguage into lp://staging/renamer

Proposed by Jonathan Jacobs
Status: Merged
Approved by: Tristan Seligmann
Approved revision: 116
Merged at revision: 84
Proposed branch: lp://staging/~renamer-developers/renamer/ditch-metalanguage
Merge into: lp://staging/renamer
Diff against target: 2443 lines (+714/-1378)
22 files modified
LICENSE (+5/-1)
bin/rn (+1/-1)
renamer/__init__.py (+2/-0)
renamer/application.py (+148/-223)
renamer/env.py (+0/-311)
renamer/errors.py (+3/-8)
renamer/irenamer.py (+28/-3)
renamer/logging.py (+12/-7)
renamer/main.py (+2/-3)
renamer/plugin.py (+57/-82)
renamer/plugins/audio.py (+56/-43)
renamer/plugins/common.py (+0/-307)
renamer/plugins/tv.py (+107/-56)
renamer/test/data/tvrage (+19/-0)
renamer/test/test_env.py (+0/-53)
renamer/test/test_plugin.py (+34/-0)
renamer/test/test_tvrage.py (+93/-16)
renamer/test/test_util.py (+89/-0)
renamer/util.py (+57/-175)
scripts/music.rn (+0/-44)
scripts/tv.rn (+0/-44)
setup.py (+1/-1)
To merge this branch: bzr merge lp://staging/~renamer-developers/renamer/ditch-metalanguage
Reviewer Review Type Date Requested Status
Tristan Seligmann Approve
Andrew Snowden Approve
Review via email: mp+37035@code.staging.launchpad.net

Description of the change

I think the value of the metalanguage has outlived itself and real Python plugins are probably a lot more useful and easy to write. The crazy config file system is also dead.

Some new features (such as creating symlinks and allowing renaming/moving across filesystem boundaries) are present too.

There really should be some more tests but I can't quite figure out where to start.

The flags "--link-dst" and "--link-src" might be more intuitive if they were named "--link-new" and "--link-original" or similar.

To post a comment you must log in.
95. By Jonathan Jacobs

Remove empty scripts directory.

96. By Jonathan Jacobs

Remove legacy code.

97. By Jonathan Jacobs

Improve logging.

98. By Jonathan Jacobs

Add more TV Rage test data.

99. By Jonathan Jacobs

Tweak setup.py.

100. By Jonathan Jacobs

Update LICENSE.

101. By Jonathan Jacobs

Helper symlinker function.

102. By Jonathan Jacobs

Tests for renamer.util.

103. By Jonathan Jacobs

More tests for renamer.plugins.tv.

104. By Jonathan Jacobs

Tests, tweaks and docs.

105. By Jonathan Jacobs

Docstring.

106. By Jonathan Jacobs

Fix pyflakes warnings.

Revision history for this message
Andrew Snowden (andrew-snowden) wrote :

Everything looks good, the only suggested change was to move the filename parsing out of the TVRage class into a base TV class so that it could be shared by any other metadata sources (e.g. thetvdb.com) since it isn't specific to TVRage. That can wait until there is actually another source implemented.

review: Approve
Revision history for this message
Tristan Seligmann (mithrandi) wrote :

> 24 from renamer._version import version
> 25 +version # Ssssh, Pyflakes.

Don't do this, use __all__ instead.

> 124 + ('dry-run', 'n', 'Perform a dry-run.'),

It might be more intuitive to make the long option name be --no-act.

> 6 +Copyright © 2007-2010 Slipgate Development cc

There isn't really such an entity as Slipgate Development cc.

> 234 + self.args = (FilePath(arg) for arg in args)

This should probably be a listcomp, not a genexp.

> 1033 +class _metaASC(type):

"ASC" stands for AxiomaticSubCommand, and thus isn't a very appropriate name here.

review: Needs Fixing
Revision history for this message
Tristan Seligmann (mithrandi) wrote :

148 + return (get,)
149 +
150 + subCommands = property(*subCommands())

This is a bit pointless, just use @property on the inner function and be done.

review: Needs Fixing
107. By Jonathan Jacobs

Simplify subCommands property.

108. By Jonathan Jacobs

Use __all__ to shut Pyflakes up, where possible.

109. By Jonathan Jacobs

Make copyright information less fictional.

110. By Jonathan Jacobs

Change dry run long option name and descriptionn to be more intuitive.

111. By Jonathan Jacobs

Store command arguments in a list instead of a generator.

112. By Jonathan Jacobs

Replace _metaASC with something more generic.

113. By Jonathan Jacobs

Doc tweak.

Revision history for this message
Jonathan Jacobs (jjacobs) wrote :

Address review commentary.

Revision history for this message
Tristan Seligmann (mithrandi) wrote :

2397 + if not (newcls.__name__ == typeName and
2398 + newcls.__module__ == moduleName):
2399 + directlyProvides(newcls, *provides)
2400 + return newcls

Okay, so. This should be alsoProvides() instead of directlyProvides(). You can also ditch the if check; instead, just throw in a noLongerProvides() after the definition of EridanusCommand to remove those interfaces from it. Finally, I think instead of this being a factory function that takes some params, it should just be a subclass of type that reads the list of interfaces off an attribute; then you just subclass it and define the interfaces as a class attribute.

2341 + if e.errno == errno.EXDEV:
2342 + raise errors.DifferentLogicalDevices(
2343 + 'Refusing to symlink "%s" to "%s" on another filesystem' % (
2344 + src.path, dst.path))

I don't understand this code at all; when would it be valid for symlink to fail with EXDEV?

1682 + key, value = line.strip().split(u'@', 1)
1683 + data[key] = value.split(u'^')

The page data is returned as a byte string, so splitting on unicode strings here is wrong.

Whew. I hope that's all!

review: Needs Fixing
114. By Jonathan Jacobs

Remove crackful EXDEV-handling symlink helper.

115. By Jonathan Jacobs

Don't split byte strings on unicode strings.

116. By Jonathan Jacobs

Replace DirectlyProvidingMetaclass insanity with something slightly less insane.

Revision history for this message
Jonathan Jacobs (jjacobs) wrote :

> Whew. I hope that's all!

Fixed.

Revision history for this message
Tristan Seligmann (mithrandi) :
review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
The diff is not available at this time. You can reload the page or download it.

Subscribers

People subscribed via source and target branches