Giter Site home page Giter Site logo

Syntax issues about bandcamp-dl HOT 8 CLOSED

iheanyi avatar iheanyi commented on August 15, 2024
Syntax issues

from bandcamp-dl.

Comments (8)

iheanyi avatar iheanyi commented on August 15, 2024

@IgorDubois Try using Python 2.7, that's what this was coded with. :X Sorry for that.

from bandcamp-dl.

Evolution0 avatar Evolution0 commented on August 15, 2024

I've forked and modified it a bit so that it works. (In Python 3.5.2 at least)

In the process I also had to modify Slugify and include it as the author seems to have abandoned it.

deps.txt and requirements.txt have been modified appropriately, must be cloned and installed from source using the instructions as I'm not about to put it on pypi (Its your project) and I'm not comfortable making a PR for it to be merged yet.

I might make a PR after I:
Recode some stuff to use asyncio/aiohttp
Merge @Bendito999's changes
Write my own function to replace Slugify.
Improve default file naming e.g: Foo - Bar (Ft. Baz).mp3 vs. foo-bar-ft-baz.mp3. --template would override.

No idea when I might do these things though, but hey at least it works in the mean time eh?

from bandcamp-dl.

iheanyi avatar iheanyi commented on August 15, 2024

Yeah. I'm wondering if there's a way we can make this work with both Python 3 and Python 2? 🤔

from bandcamp-dl.

Evolution0 avatar Evolution0 commented on August 15, 2024

I've kinda got it cross-compatible as-in it at least grabs the tracks and names them from a bc album/page link.

Currently not working:

Metadata
Album art
Progress bar (Broken in Python 2.7.11 and 3.5.2)

If the progress bar is part of wgetter (I would assume so) I might end up replacing it anyway, as having wgetter and requests is kind of redundant.

Possibly more. I'll mess around with it some more later :)

Edit: In case its not obvious I have not committed my most recent changes in my fork.

from bandcamp-dl.

iheanyi avatar iheanyi commented on August 15, 2024

@Evolution0 I think the point of having wgetter was in order to have an easy way to download files to a specific output file more easily than you can do with Requests. Been awhile since I've worked on this script but that was my thought process around it.

from bandcamp-dl.

Evolution0 avatar Evolution0 commented on August 15, 2024

Hm, currently it is:

tmp_file = wgetter.download(track_url, outdir=dirname)
os.rename(tmp_file, filename)

With requests:

r = requests.get(track_url, stream=True)
with open(dirname + "/" + filename, "wb") as file:
    file.write(r.content)

Not much harder and gets rid of a dep.

Edit: As a side effect of trying this out I noticed create_directory returns a strangely formed path (In my case):
'D:\\bandcamp-dl\\bandcamp-dl\\bandcamp_dl/the-enigma-tng/asia-deth'

Its mixing back and forward slashes because os.path isn't getting free reign to form the path itself. Its pretty smart, you can just set artist and album as folder names then join them to get the path.

I think maybe wgetter autocorrected the path?

from bandcamp-dl.

iheanyi avatar iheanyi commented on August 15, 2024

@Evolution0 - Yeah, that may be the case. I honestly wasn't sure how WGetter was handling it, but it's a thin wrapper around wget so it probably does auto-correct the paths.

from bandcamp-dl.

Evolution0 avatar Evolution0 commented on August 15, 2024

I found that the path formed by template_to_path was perfectly fine but when using requests to download the track I only needed the filename variable.

I removed what Python 2.7.X code I had for backwards compatibility while I sorted the dependency issue out.

I got everything working under Python 3.5.2 with the latest version of the deps, current dep list looks like this:

beautifulsoup4==4.5.1
docopt==0.6.2
lxml==3.6.4
mutagen==1.35.1
ply==3.9
requests==2.12.3
slimit==0.8.1
unicode-slugify==0.1.3

I added the progress bar back in without using a module so that is nice.

Now I just need to make it cross-compatible without making a mess of the code this time.

from bandcamp-dl.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.