qbittorrent / qBittorrent

qBittorrent BitTorrent client
https://www.qbittorrent.org
Other
27.1k stars 3.9k forks source link

[Wishlist] portable version (Windows) #465

Closed jpff closed 7 years ago

jpff commented 11 years ago

Ideally, I'd like to simply have a .zip file with the qBittorrent files in it, ready to run.

Settings and everything would stay contained inside the qBittorrent folder, it wouldn't write outside of it or to the registry.

UgurGumushan commented 8 years ago

+1. just use ini files

bottleblue commented 8 years ago

Still no portable version? It's been almost 3 years. Do we need a kickstarter or something? C'mon please!

mzso commented 8 years ago

@bottleblue commented on 2015. dec. 30. 15:47 CET:

Still no portable version? It's been almost 3 years. Do we need a kickstarter or something? C'mon please!

Get a software dev friend to implement it and then make a pull request.

bottleblue commented 8 years ago

I'd rather just pay someone. Or keep using Tixati.

fcore117 commented 8 years ago

Tixati = no source, suspicious.

Owyn commented 8 years ago

qbitTorrent = no portable, not handy.

chrishirst commented 8 years ago

qTorrent = no portable, not handy.

Do you mean qbittorrent ???

As qTorrent is a different species of bittorrent client that is NOT supported here.

I'd rather just pay someone. Or keep using Tixati.

Or use the portableapps version. It is not supported here or at the support forum (when it resurfaces), but it apparently works as one would expect.

bottleblue commented 8 years ago

I think this has already been mentioned but the portableapps versions is not truly portable as it writes to the %appdata% folder.

chrishirst commented 8 years ago

I think this has already been mentioned but the portableapps versions is not truly portable as it writes to the %appdata% folder.

You will have to take that up with them, but until one of the qbittorrent volunteer developers finds the fairly substantial amount of time it will take to fully convert the qbittorrent code ... for all operating systems, It's the best option available.

JohnTHaller commented 8 years ago

The PortableApps.com package is fully portable. It temporarily writes to APPDATA and LOCALAPPDATA while it is running due to that being the hard-coded path used by qBittorrent itself. As mentioned above, we: "(1) ensure a local copy of qBittorrent isn't running, (2) backup any data in those locations, (3) move the portable version's data to those locations, (4) adjust the paths in the confirguration, (5) run qBittorrent and wait for it to finish, (6) move the portable data back to the portable's Data folders, (7) restore the original backed-up data if there is any. Nothing is left behind unless Windows crashes or shut down without exiting the app. It's not elegant, but it's the only way to have qBittorrent run portably. If there were any command line options to point qBittorrent to its data files, we'd utilize them as we do in our other apps." Portable apps have always been allowed to temporarily write to the local machine: http://portableapps.com/about/what_is_a_portable_app

denisps commented 8 years ago

"Nothing is left behind unless Windows crashes or shut down without exiting the app." If something can happen, it certainly will. And when it does happen, not only does it leave a whole mess behind, which defeats the whole purpose of it being portable, but it's not even starting afterwords, saying something like "the app is already running" with no way of telling where does it get this nonsense from. What also is left behind every time you run the PortableApps qbittorrent is the thousands of clusters on the hard drive containing the logs of what you have been downloading.

That is why I avoid using PortableApps as much as possible. I'd rather just add a portable switches to the shortcuts or use thinapp-like portabilizers.

It also looks like some of those apps are unnecessarily over portabilized and not in the right way. uTorrent, for instance, does not need a portabilizer, especially as messy as this one. You just copy its executable in an empty folder with an empty settings.dat file and whoala, it's portable. If setting.dat is not there and it's not located in the program files folder, it offers to install itself.

Aimp comes with it's own portable installer. And many others also do.

Transmission-bt comes with profile switch and and its third party build runs great on windows with the smallest footprint of all the bittorrent clients. Yeap, that's what I'm using now, but I can't recommend it to an average person because to get the best out of it you need configuration files tweaking.

Fossius commented 8 years ago

I think the author does not know how to do it, and is afraid to admit it. Some even offer to pay for it, so the conclusion arises by itself.

JohnTHaller commented 8 years ago

denisps - That's why all PortableApps.com apps make use of every single portablization ability available in the underlying apps and then expand upon it. The only reason qBittorrent is copied back and forth is because it's the only way to do it. uTorrent is only "kind of portable" with the settings.dat as it will leave a half dozen registry keys behind and some files in LOCALAPPDATA. Your torrents will also break as you move the drive from PC to PC as it uses full paths within settings.dat. The uTorrent Portable launcher handles all of that automatically. Transmission-Qt makes it so you can't eject your drive due to DBUS Daemon running and locking it after you exit. Our launcher handles that for users as well as portablizing paths.

Some users are fine with apps that aren't really portable (leaving files/registry keys, having settings or file paths break as you move PCs) as they're more concerned with not having to install them. Others want fully portable apps. We cater to the latter group.

JohnTHaller commented 8 years ago

Fossius - Someone saying they'll fund development vs actually putting up the funds to fully pay for a developer's time are two different things. Portable is a relatively small niche. And users who aren't satisfied with the existing portable option and want it done differently is a small niche of a small niche. You don't know what the developer's time commitments are like or what else is going on in their lives. Claiming they don't know how to do it is unfair and most likely inaccurate.

sledgehammer999 commented 8 years ago

Some even offer to pay for it, so the conclusion arises by itself.

Let me hear offers in bitcoin. And then I'll start coding at 1st priority.

dogancelik commented 8 years ago
Let me hear offers in bitcoin. And then I'll start coding at 1st priority.

I don't have bitcoins but if Bountysource is enabled for this repository, I will contribute.

Bountysource allows people to put bounty on issues. If people want a feature, they can put bounty on it. Bounty goes to team/person who fixes that issue.

From Bountysource settings page:

This team is maintained by the community. This team has no members and the data below can be edited by any user. If you are a core member of this team please Claim This Team.

If enabled, Bountysource will also edit title when an issue gets a bounty (Issue title + bounty amount)

mzso commented 8 years ago

@JohnTHaller commented on 2016. jan. 5. 17:10 CET:

denisps - That's why all PortableApps.com apps make use of every single portablization ability available in the underlying apps and then expand upon it. The only reason qBittorrent is copied back and forth is because it's the only way to do it. uTorrent is only "kind of portable" with the settings.dat as it will leave a half dozen registry keys behind and some files in LOCALAPPDATA. Your torrents will also break as you move the drive from PC to PC as it uses full paths within settings.dat. The uTorrent Portable launcher handles all of that automatically. Transmission-Qt makes it so you can't eject your drive due to DBUS Daemon running and locking it after you exit. Our launcher handles that for users as well as portablizing paths.

Some users are fine with apps that aren't really portable (leaving files/registry keys, having settings or file paths break as you move PCs) as they're more concerned with not having to install them. Others want fully portable apps. We cater to the latter group.

Actually it can use relative paths. I have the save torrents path as ".\torrents" for ages.

JohnTHaller commented 8 years ago

Interesting that uTorrent finally fixed it and added relative path support back in. uTorrent used to support relative paths that mostly worked but then broke support for it in the original uTorrent 3.3 release. All the torrents in resume.dat would break every time you moved drives because they included full paths. We custom coded our launcher to be able to adjust them and work with the uTorrent fileguard setups within the files. At least that makes uTorrent more portable on its own if you disregard the registry entries and local files/folders it leaves behind on every PC.

mzso commented 8 years ago

@JohnTHaller commented on 2016. jan. 5. 22:39 CET:

Interesting that uTorrent finally fixed it and added relative path support back in. uTorrent used to support relative paths that mostly worked but then broke support for it in the original uTorrent 3.3 release. All the torrents in resume.dat would break every time you moved drives because they included full paths. We custom coded our launcher to be able to adjust them and work with the uTorrent fileguard setups within the files. At least that makes uTorrent more portable on its own if you disregard the registry entries and local files/folders it leaves behind on every PC.

I see. Well, I use 3.1.3, because later versions are advertisement filled garbage. I'm also quite sure this version doesn't leave files behind. (Not sure about registry)

Owyn commented 7 years ago

To implement this we add two options, avaliable via command line switches

so If I just open a .torrent file and program thus would launch without any custom command line switches I'd loose all my portable settings in this launch?

zeule commented 7 years ago

You may use environment variables for this case.

fcore117 commented 7 years ago

So environment variable has been added to set settings location if this issue is closed? what is command for that?

zeule commented 7 years ago

qBittorent command line parameters can be learned from its help output (qbittorrent -h). There you will find how to pass these parameters via environment variables.

bottleblue commented 7 years ago

What do all these recent replies have to do with portability? Does qbittorrent have a portable version now or commands to make it portable?

zeule commented 7 years ago

or commands to make it portable?

Yes, in the master branch.

bottleblue commented 7 years ago

Yes, in the master branch.

Are there instructions how to make it portable? I'm not sure if I can figure it out.

zeule commented 7 years ago

Have you checked its --help output?

bottleblue commented 7 years ago

I don't even know how to use the master branch :/

zeule commented 7 years ago

Then you have to wait for the next release.

bottleblue commented 7 years ago

ok thx.

fcore117 commented 7 years ago

Gongrats, very good and waiting for next release :) goodbye portableapps paf release.

sledgehammer999 commented 7 years ago

Then you have to wait for the next release.

To be more precise you have to wait for the 3.4.0 release. It should the next one unless we discover bugs for the 3.3.x series, which will make me do a 3.3.13 release.

mzso commented 7 years ago

So let me get this straight:

Also, how on earth this second one be considered portable? You need to modify the system to set an environmental variable.

zeule commented 7 years ago

Here is a copy of qbittorrent --help from current master:

$ ./qbittorrent --help
Qt C locale unrecognized, using default (en).
C locale unrecognized, using default (en).
Usage:
        ./qbittorrent [options] [(<filename> | <url>)...]
Options:
        -v | --version          Displays program version and exit
        -h | --help             Displays this help message and exit
        --webui-port=<port>     Changes the Web UI port
        --no-splash             Disable splash screen
        --profile=<dir>         Store configuration files in <dir>
        --configuration=<name>  Store configuration files in directories qBittorrent_<name>
        --relative-fastresume   Hack into libtorrent fastresume files and make file paths relative to the profile directory
        --portable              Shortcut for --profile=<exe dir>/profile --relative-fastresume
        files or urls           Downloads the torrents passed by the user

Option values may be supplied via environment variables.
For option named 'parameter-name', environment variable name is 'QBT_PARAMETER_NAME' (in upper case, '-' replaced with '_')
To pass flag values, set the variable to '1' or 'TRUE'.
For example, to disable the splash screen: QBT_NO_SPLASH=1 ./qbittorrent

Command line parameters take precedence over environment variables

Use an environmental variable. But how? Do you create an system or user environmental variable via Windows' system settings? But what's the variable's name and it's value?

Yes, one may use Windows system settings, as well as his own launch script. BTW, doesn't Windows allow to specify environment variables in .shortcut file?

Also, how on earth this second one be considered portable? You need to modify the system to set an environmental variable.

That was an answer to question "How to open an URL or .torrent file using the portable mode?" And when one wants integration with system, there has to be a link between an app and the OS. For instance via an environment variable. What's wrong with that?

mzso commented 7 years ago

@evsh commented on Apr 12, 2017, 5:37 PM GMT+2:

Yes, one may use Windows system settings, as well as his own launch script. BTW, doesn't Windows allow to specify environment variables in .shortcut file?

I don't. I expect a .bat script is needed. Which is quite a nuisance. Does setting the variable help when you open a a torrent via double clicking an associated .torrent file, or do you get a different instance (or something worse)?

Is it possible that something more robust will be implemented? Most apps that support portable mode natively either check for configuration files in their exe's location, or a specific empty file (eg: "portable.dat").

sledgehammer999 commented 7 years ago

Windows shortcuts allow to edit them to pass switches/arguments to the application.

IIRC, current portability implementation doesn't allow separate instances. If you have an already running instance with X profile any subsequent instance, no matter its profile, will pass arguments to the first one and then exit.

zeule commented 7 years ago

Does setting the variable help when you open a a torrent via double clicking an associated .torrent file

Can't understand you. You are OK with registry records for file associations, but don't want to set an environment variable? Besides, if qBt is running already (launched as portable), the second instance which is launched via a file association will just pass that file name to the running one and exit.

Is it possible that something more robust will be implemented? Most apps that support portable mode natively either check for configuration files in their exe's location, or a specific empty file (eg: "portable.dat").

Yes, certainly. For instance, we can look for $EXENAME.options file and read command line options from it if the file is readable. Would that satisfy your needs?

mzso commented 7 years ago

@evsh commented on Apr 12, 2017, 6:31 PM GMT+2:

Does setting the variable help when you open a a torrent via double clicking an associated .torrent file

Can't understand you. You are OK with registry records for file associations, but don't want to set an environment variable? Besides, if qBt is running already (launched as portable), the second instance which is launched via a file association will just pass that file name to the running one and exit.

My problem was reliability. Whether I can accidentally start QBT in non portable mode. (Also it still might make sense to have QBT associated on my local machine for convenience's sake but still have it portable so I can move it to a different computer)

Yes, certainly. For instance, we can look for $EXENAME.options file and read command line options from it if the file is readable. Would that satisfy your needs?

That sounds great!

Owyn commented 7 years ago

For instance, we can look for $EXENAME.options file and read command line options from it if the file is readable. Would that satisfy your needs?

That would be great

satysin commented 7 years ago

Looks like this didn't make it into 3.3.13?? :(

thalieht commented 7 years ago

Nope, it'll be in 3.4.0

xbliss commented 7 years ago

Did anything happen on this front?

mzso commented 7 years ago

@xbliss commented on 2017. jún. 29. 08:46 CEST:

Did anything happen on this front?

Try reading comments...

mzso commented 6 years ago

@evsh commented on 2017. ápr. 12. 18:31 CEST:

Yes, certainly. For instance, we can look for $EXENAME.options file and read command line options from it if the file is readable. Would that satisfy your needs?

Hello! Did this happen? There was one commit after this one, but it doesn't detail what has changed. (As far as I can tell) Update: I tried adding "--portable" to qbittorrent.options and qbittorrent.exe.options, so unless a different file is searched, it wasn't implemented so far.

@sledgehammer999 commented on 2017. ápr. 12. 18:29 CEST:

Windows shortcuts allow to edit them to pass switches/arguments to the application.

IIRC, current portability implementation doesn't allow separate instances. If you have an already running instance with X profile any subsequent instance, no matter its profile, will pass arguments to the first one and then exit.

Is this true to QBT installations in different locations also? If yes then QBT can't really be considered having a functioning portable mode. The host system might have a different instance running, which the user might not have rights to close. Apart from this a portable program shouldn't conflict with local or other portable instances at all. Update: So I tested this also, and sadly it conflicts with QBT instances from completely different folders.

Owyn commented 6 years ago

a Portable installation in download section would also be nice btw when it's supported already (is it?)

mzso commented 6 years ago

@Owyn commented on 2018. febr. 6. 14:57 CET:

(is it?)

Not really. See above. You need pass an argument every time you start it. It also conflicts with other instances from other folders. eg: if you have a local QBT elswhere and a "portable" one.

mzso commented 6 years ago

@Owyn commented on 2018. febr. 6. 14:57 CET:

a Portable installation in download section would also be nice btw when it's supported already (is it?)

Oh yeah, forgot to add that that there's no distinct version. You just need to pass --portable to QBT v4.0+

avih commented 6 years ago

As far as I understand, portable mode can be set via --portable CLI argument or some env vars, but not detected automatically via the presence of a portable config dir/file at the executable dir, is that correct?

If yes, can someone please explain the main objection to auto-portable by detecting via some ini file or dir at the executable dir?

The "pro" arguments for such auto detection were mentioned earlier, but to name a few: the common way by other apps is auto-detection, CLI args are not passed when invoked externally (via file association etc), and global env vars are both not easy to set for "normal" users, and some might consider them polluting, and more.

I didn't test this code nor ever compiled qBittorrent, but I did look at the code and it seems to me that this patch (or something along those lines) could make it work in such auto-portable mode.

diff --git a/src/app/application.cpp b/src/app/application.cpp
index ebc32f909..e2ccf023c 100644
--- a/src/app/application.cpp
+++ b/src/app/application.cpp
@@ -118,9 +118,9 @@ Application::Application(const QString &id, int &argc, char **argv)
     setApplicationName("qBittorrent");
     validateCommandLineParameters();

-    QString profileDir = m_commandLineArgs.portableMode
-        ? QDir(QCoreApplication::applicationDirPath()).absoluteFilePath(DEFAULT_PORTABLE_MODE_PROFILE_DIR)
-        : m_commandLineArgs.profileDir;
+    QString profileDir = QDir(QCoreApplication::applicationDirPath()).absoluteFilePath(DEFAULT_PORTABLE_MODE_PROFILE_DIR);
+    if (!m_commandLineArgs.portableMode && !QDir(profileDir).exists())
+        profileDir = m_commandLineArgs.profileDir;

     Profile::initialize(profileDir, m_commandLineArgs.configurationName,
                         m_commandLineArgs.relativeFastresumePaths || m_commandLineArgs.portableMode);

Or maybe (handle relative paths better just below?):

diff --git a/src/app/application.cpp b/src/app/application.cpp
index ebc32f909..8e30efffe 100644
--- a/src/app/application.cpp
+++ b/src/app/application.cpp
@@ -118,6 +118,8 @@ Application::Application(const QString &id, int &argc, char **argv)
     setApplicationName("qBittorrent");
     validateCommandLineParameters();

+    if (QDir(QCoreApplication::applicationDirPath()).absoluteFilePath(DEFAULT_PORTABLE_MODE_PROFILE_DIR).exists())
+        m_commandLineArgs.portableMode = true;
     QString profileDir = m_commandLineArgs.portableMode
         ? QDir(QCoreApplication::applicationDirPath()).absoluteFilePath(DEFAULT_PORTABLE_MODE_PROFILE_DIR)
         : m_commandLineArgs.profileDir;

Would it work? would there be an objection to add it?

thalieht commented 6 years ago

The author of this feature is inactive for months and i don't think the other devs follow this issue so let's call them @glassez @Chocobo1 ☝️

1265578519 commented 6 years ago

我感觉在目录下创建一个文件,如果exe检测到文件存在则自动便捷式岂不更好?