mirror of
https://github.com/beetbox/beets.git
synced 2025-12-06 16:42:42 +01:00
Review: Rename method
This commit is contained in:
parent
68ccfe0e6c
commit
076a82daa6
4 changed files with 7 additions and 7 deletions
|
|
@ -222,7 +222,7 @@ def sorted_walk(path, ignore=(), ignore_hidden=False, logger=None):
|
||||||
for res in sorted_walk(cur, ignore, ignore_hidden, logger):
|
for res in sorted_walk(cur, ignore, ignore_hidden, logger):
|
||||||
yield res
|
yield res
|
||||||
|
|
||||||
def pathlib_as_posix(path):
|
def path_as_posix(path):
|
||||||
"""Return the string representation of the path with forward (/)
|
"""Return the string representation of the path with forward (/)
|
||||||
slashes.
|
slashes.
|
||||||
"""
|
"""
|
||||||
|
|
|
||||||
|
|
@ -18,7 +18,7 @@ import os
|
||||||
import fnmatch
|
import fnmatch
|
||||||
import tempfile
|
import tempfile
|
||||||
import beets
|
import beets
|
||||||
from beets.util import pathlib_as_posix
|
from beets.util import path_as_posix
|
||||||
|
|
||||||
|
|
||||||
class PlaylistQuery(beets.dbcore.Query):
|
class PlaylistQuery(beets.dbcore.Query):
|
||||||
|
|
@ -163,7 +163,7 @@ class PlaylistPlugin(beets.plugins.BeetsPlugin):
|
||||||
new_path = self.changes[beets.util.normpath(lookup)]
|
new_path = self.changes[beets.util.normpath(lookup)]
|
||||||
except KeyError:
|
except KeyError:
|
||||||
if self.config['forward_slash']:
|
if self.config['forward_slash']:
|
||||||
line = pathlib_as_posix(line)
|
line = path_as_posix(line)
|
||||||
tempfp.write(line)
|
tempfp.write(line)
|
||||||
else:
|
else:
|
||||||
if new_path is None:
|
if new_path is None:
|
||||||
|
|
@ -176,7 +176,7 @@ class PlaylistPlugin(beets.plugins.BeetsPlugin):
|
||||||
new_path = os.path.relpath(new_path, base_dir)
|
new_path = os.path.relpath(new_path, base_dir)
|
||||||
line = line.replace(original_path, new_path)
|
line = line.replace(original_path, new_path)
|
||||||
if self.config['forward_slash']:
|
if self.config['forward_slash']:
|
||||||
line = pathlib_as_posix(line)
|
line = path_as_posix(line)
|
||||||
tempfp.write(line)
|
tempfp.write(line)
|
||||||
|
|
||||||
if changes or deletions:
|
if changes or deletions:
|
||||||
|
|
|
||||||
|
|
@ -21,7 +21,7 @@ from __future__ import division, absolute_import, print_function
|
||||||
from beets.plugins import BeetsPlugin
|
from beets.plugins import BeetsPlugin
|
||||||
from beets import ui
|
from beets import ui
|
||||||
from beets.util import (mkdirall, normpath, sanitize_path, syspath,
|
from beets.util import (mkdirall, normpath, sanitize_path, syspath,
|
||||||
bytestring_path, pathlib_as_posix)
|
bytestring_path, path_as_posix)
|
||||||
from beets.library import Item, Album, parse_query_string
|
from beets.library import Item, Album, parse_query_string
|
||||||
from beets.dbcore import OrQuery
|
from beets.dbcore import OrQuery
|
||||||
from beets.dbcore.query import MultipleSort, ParsingError
|
from beets.dbcore.query import MultipleSort, ParsingError
|
||||||
|
|
@ -208,7 +208,7 @@ class SmartPlaylistPlugin(BeetsPlugin):
|
||||||
with open(syspath(m3u_path), 'wb') as f:
|
with open(syspath(m3u_path), 'wb') as f:
|
||||||
for path in m3us[m3u]:
|
for path in m3us[m3u]:
|
||||||
if self.config['forward_slash'].get():
|
if self.config['forward_slash'].get():
|
||||||
path = pathlib_as_posix(path)
|
path = path_as_posix(path)
|
||||||
f.write(path + b'\n')
|
f.write(path + b'\n')
|
||||||
|
|
||||||
self._log.info(u"{0} playlists updated", len(self._matched_playlists))
|
self._log.info(u"{0} playlists updated", len(self._matched_playlists))
|
||||||
|
|
|
||||||
|
|
@ -198,7 +198,7 @@ class HelperTest(_common.TestCase):
|
||||||
def test_forward_slash(self):
|
def test_forward_slash(self):
|
||||||
p = r'C:\a\b\c'
|
p = r'C:\a\b\c'
|
||||||
a = r'C:/a/b/c'
|
a = r'C:/a/b/c'
|
||||||
self.assertEqual(util.pathlib_as_posix(p), a)
|
self.assertEqual(util.path_as_posix(p), a)
|
||||||
|
|
||||||
|
|
||||||
class AlbumFileTest(_common.TestCase):
|
class AlbumFileTest(_common.TestCase):
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue