Did I find the right examples for you? yes no      Crawl my project      Python Jobs

All Samples(35)  |  Call(28)  |  Derive(0)  |  Import(7)

        def warning(s):
    print(colorize('[warning] ', 'yellow', bold=True) + s)
        


src/m/p/mpdc-HEAD/mpdc/mpdc_database.py   mpdc(Download)
 
from mpdc.initialize import mpd, collectionsmanager, lastfm, cache, colors
from mpdc.libs.utils import repr_tags, info, warning, colorize
 
 
        missing_tags = [tag for tag, value in tags.items() if not value]
        if missing_tags:
            warning(colorize(song, colors[0]))
            print('missing tag(s): ' + colorize(', '.join(missing_tags),
                                                colors[1 % len(colors)]))
        print('------------------')
        for tags in duplicates:
            warning('Conflict with tags ' + colorize(repr_tags([tags['artist'],
                                                               tags['album'],
                                                               tags['title'],

src/m/p/mpdc-HEAD/mpdc/initialize.py   mpdc(Download)
from configparser import ConfigParser
 
from mpdc.libs.utils import Cache, warning, colors_c, columns_w
 
 
config = ConfigParser()
 
if not config.read(os.path.expanduser('~/.mpdc')):
    warning('Cannot read the configuration file, please run mpdc-configure')
    config['mpdc']['collections']
except KeyError:
    warning('Invalid configuration file')
    sys.exit(0)
 
 
if not mpd.connect():
    warning('Unable to connect to the MPD server')
    sys.exit(0)
 
    open(c_path, 'r')
except IOError:
    warning('Collections file [{}] does not seem readable'.format(c_path))
    sys.exit(0)
 

src/m/p/mpdc-HEAD/mpdc/libs/parser.py   mpdc(Download)
 
from mpdc.initialize import mpd, collectionsmanager, lastfm, enable_command
from mpdc.libs.utils import format_mpc_output, warning, OrderedSet
 
 
def t_error(t):
    warning('Illegal character `{}`'.format(t.value[0]))
    sys.exit(0)
 
 
                p[0] |= OrderedSet(format_mpc_output(output.decode()))
            except subprocess.CalledProcessError:
                warning('Error while executing `command` in collection [{}]'.
                        format(p[1]))
                sys.exit(0)
                                  album=mpd.get_tag(c_song, 'album')))
    else:
        warning('Collection [{}] does not exist'.format(p[1]))
        sys.exit(0)
 
    pattern = p[1][2:-1] if p[1][1] in '"\'' else p[1][3:-1]
    if not name:
        warning('Filter [{}] does not exist'.format(alias))
        sys.exit(0)
    if name == 'lastfm_a':

src/m/p/mpdc-HEAD/mpdc/mpdc_collections.py   mpdc(Download)
from mpdc.initialize import mpd, collectionsmanager, cache, colors, columns, \
                            enable_pager, pager
from mpdc.libs.utils import input_box, esc_quotes, info, warning, colorize, \
                            columns_width
from mpdc.libs.parser import parser
            display_songs(collection['songs'], args.f)
    else:
        warning('Stored collection [{}] does not exist'.format(args.alias))
 
 

src/m/p/mpdc-HEAD/mpdc/mpdc_configure.py   mpdc(Download)
from configparser import ConfigParser
 
from mpdc.libs.utils import info, warning
 
 
        if os.path.isfile(path):
            break
        warning('Cannot find the file: ' + path)
    print('\n')
    config['mpdc']['collections'] = path
            info('Writing configuration file in: ' + filepath)
    except IOError:
        warning('Cannot write configuration file in: ' + filepath)
 
 
def change_default_profile(profile):
    config = ConfigParser()
    filepath = os.path.expanduser('~/.mpdc')
    if not config.read(filepath):
        warning('Cannot read the configuration file, run mpdc-configure')
            info('Writing configuration file in: ' + filepath)
    except IOError:
        warning('Cannot write configuration file in: ' + filepath)
 
 

src/m/p/mpdc-HEAD/mpdc/libs/lastfmhelper.py   mpdc(Download)
 
from mpdc.initialize import cache
from mpdc.libs.utils import similarity, warning
 
 
        except (socket.timeout, urllib.error.URLError):
            if self.timeout == 3:
                warning('Cannot send the request after 4 attempts')
                self.timeout = 0
                return None
            self.timeout += 1
            warning('Time out... attempt n°' + str(self.timeout + 1))
            response = json.loads(raw_json.decode('utf-8'))
            if 'error' in response:
                warning('LastFM error: {}'.format(response['message']))
                return None
            self.timeout = 0
    def get_artist_tags(self, artist, update=False):
        if not update:
            if not self.artists_tags:
                warning('You should update the LastFM database')
            elif artist in self.artists_tags:

src/m/p/mpdc-HEAD/mpdc/libs/collectionsmanager.py   mpdc(Download)
 
from mpdc.initialize import mpd, cache
from mpdc.libs.utils import repr_tags, info, warning
 
 
    def add_songs(self, alias, songs_files):
        if not alias in self.c or not 'mpd_playlist' in self.c[alias]:
            for song in songs_files[:]:
                if not all(mpd.get_tags(song)):
                    warning('[{}] was not added (missing tags)'.format(song))
            self.need_update = True
        else:
            warning('Collection [{}] does not exist or contains no song to '
                    'remove'.format(alias))
 
                        collections[alias]['songs'].append(matched_songs[0])
                    else:
                        warning('In collection [{}], these tags do not match '
                                'any song: {}'.format(alias, repr_tags(tags)))
                else:
                                       mpd.get_stored_playlist_songs(playlist)}
        else:
            warning('MPD playlist [{}] was ignored because a collection with '
                    'the same name already exists'.format(playlist))
    return collections