Giter Club home page Giter Club logo

Comments (9)

billhongs avatar billhongs commented on June 8, 2024

Some books have the same short book name on safaribooks.

from safaribooks.

lorenzodifuccia avatar lorenzodifuccia commented on June 8, 2024

I fixed this issue! Thanks again!
But I don't understand the last comment. What do you mean?

from safaribooks.

billhongs avatar billhongs commented on June 8, 2024

Some books have the same short book name on safaribooks.

For example,the following two books have the same short name: Stepping Up

https://www.safaribooksonline.com/library/view/stepping-up/9781292186887/
https://www.safaribooksonline.com/library/view/stepping-up/9781609940584/

from safaribooks.

lorenzodifuccia avatar lorenzodifuccia commented on June 8, 2024

Ok, with the last commit I fixed this problem.
Thanks for helping me!

from safaribooks.

billhongs avatar billhongs commented on June 8, 2024

def escape_dirname(dirname, clean_space=False):
if ":" in dirname:
if dirname.index(":") > 30:
dirname = dirname.split(":")[0]

    for ch in ['\\', '/', '<', '>', '`', '\'', '"', '*', '?', '|']:
        if ch in dirname:
            dirname = dirname.replace(ch, "")

    return dirname if not clean_space else dirname.replace(" ", "")

this Statement maybe wrong,not 30 but 0
if dirname.index(":") > 30:

from safaribooks.

lorenzodifuccia avatar lorenzodifuccia commented on June 8, 2024

I voluntarily put 30 because I want to split only long titles.
Example: there is a book called "HTTP: The Definitive Guide". It's ok for me to display all the book title.
But I can't say the same for a book like "Windows Internals, Part 1: System architecture, processes, threads, memory management, and more, Seventh Edition".
Maybe I have to reduce the range...

from safaribooks.

lorenzodifuccia avatar lorenzodifuccia commented on June 8, 2024

Now is 15 chars

from safaribooks.

billhongs avatar billhongs commented on June 8, 2024

def escape_dirname(dirname, clean_space=False):
if ":" in dirname and dirname.index(":") > 15:
dirname = dirname.split(":")[0]

    for ch in ['\\', '/', '<', '>', '`', '\'', '"', '*', '?', '|']:
        if ch in dirname:
            dirname = dirname.replace(ch, "")

    return dirname if not clean_space else dirname.replace(" ", "")

Running on Windows system, dirname cannot include ":“.

for ch in ['\', '/', '<', '>', '`', ''', '"', '*', '?', '|', ':']:
if ch in dirname:
dirname = dirname.replace(ch, "")

from safaribooks.

lorenzodifuccia avatar lorenzodifuccia commented on June 8, 2024

I always use Linux, so I don't cover well the problems on Windows.
I updated the program adding this fix.

from safaribooks.

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.