Skip to content

Commit

Permalink
Rely on jaraco.path for is_hidden functionality.
Browse files Browse the repository at this point in the history
  • Loading branch information
jaraco committed Dec 31, 2020
1 parent 27ad907 commit 6ad8383
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 17 deletions.
5 changes: 5 additions & 0 deletions CHANGES.rst
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
v3.2.0
======

Rely on ``jaraco.path`` for hidden file detection.

v3.1.1
======

Expand Down
28 changes: 11 additions & 17 deletions jaraco/media/handbrake.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,14 @@
import re
import datetime
import threading
import importlib
import platform
import sys
import ctypes

import path
import jaraco.path
from jaraco.ui import menu
from jaraco.functools import call_aside

try:
from jaraco.windows.power import no_sleep
Expand All @@ -22,6 +23,15 @@
from . import config


@call_aside
def add_hidden_method():
"""
>>> path.Path('.').is_hidden()
False
"""
path.Path.is_hidden = jaraco.path.is_hidden


def source_is_high_def():
blueray_dir = os.path.join(dvd.get_source(), 'BDMV')
return os.path.isdir(blueray_dir)
Expand All @@ -46,22 +56,6 @@ def get_handbrake_cmd():
]


def is_hidden(filepath):
filepath = os.path.abspath(filepath)
return filepath.startswith('.') or has_hidden_attribute(filepath)


def has_hidden_attribute(filepath):
try:
filesystem = importlib.import_module('jaraco.windows.filesystem')
except ImportError:
return False
return filesystem.GetFileAttributes(filepath).hidden


path.Path.is_hidden = is_hidden


class TitleInfo:
def __init__(self, title_no, title, episode, root, ext):
self.__dict__.update(vars())
Expand Down
2 changes: 2 additions & 0 deletions setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@ install_requires =
jaraco.text >= 3.4
jaraco.ui
jaraco.context
jaraco.path >= 3.1
jaraco.functools
httpagentparser
more_itertools
path
Expand Down

0 comments on commit 6ad8383

Please sign in to comment.