vikstrous / pirate-get

A command line interface for The Pirate Bay
GNU Affero General Public License v3.0
337 stars 53 forks source link

Config file isn't created by default when I start pirate-get #102

Closed covertbert closed 7 years ago

covertbert commented 7 years ago

Tried creating one manually in $HOME/.config/pirate-get and the settings seem to just be ignored.

Presumably I'm doing something wrong, but I'm not sure what...

rnhmjoj commented 7 years ago

You are right, my bad: I wrote in the README that pirate-get will create the config file but it never did. I should just remove it: it's not really useful to make an empty config and someone who only uses the command line probably doesn't want it either.

Anyway, it should work after you created one manually. What options did you try?

covertbert commented 7 years ago

No worries and yeah that makes sense!

I just tried changing the "mirror" value to a URL that works with my ISP. It seemed to just ignore it, though, and used the standard URL.

rnhmjoj commented 7 years ago

Can you paste the file here?

covertbert commented 7 years ago

I literally just copied and pasted your example into a file, changing only the mirror value. One thing I may have been doing wrong is the name of the file perhaps? My path is $HOME/.config/pirate-get/pirate-get.sh.

Here's the contents of the file anyway:

[Save]
; directory where to save files
directory = $PWD

; save each selected magnet link in a .magnet file
magnets = false

; save each selected torrent in a .torrent file
torrents = false                     

[LocalDB]
; use a local copy of the pirate bay database
enabled = false                 

; path of the database     
path = ~/downloads/pirate-get/db

[Misc]
; specify a custom command for opening the magnet
; ex. myprogram --open %s
; %s represent the magnet uri
openCommand = 

; open magnets with transmission-remote client
transmission = false

; use colored output
colors = true

; the pirate bay mirror(s) to use:
; one or more space separated URLs
mirror = https://pirateproxy.vip
rnhmjoj commented 7 years ago

The only thing I can think of is you have $XDG_CONFIG_HOME set to something other than $HOME/.config

covertbert commented 7 years ago

I've spent a fair but of time googling $XDG_CONFIG_HOME to try and figure out if that's the case, but I can't really get my head round exactly how you check or set it.

I don't suppose you'd be able to point me in the right direction? I've tried on both my Mac (OS Sierra) and my raspberry pi (OSMC which I believe is based on Debian).

rnhmjoj commented 7 years ago

If you don't know about it then it's probably unset, anyway do echo $XDG_CONFIG_HOME to check the content. Ultimately, to see what's really going on, you should run strace on pirate-get:

$ strace -e open pirate-get

If it's reading the config correctly you should see near the bottom of the text:

open("/<path-to-your-home>/.config/pirate-get", O_RDONLY|O_CLOEXEC) = 4
covertbert commented 7 years ago

echo $XDG_CONFIG_HOME returns a blank string, so presumably this means it isn't set?

When running strace -e open pirate-get, it doesn't appear to return any lines that contain pirate-get.

Just to clarify, is this the correct path: $HOME/.config/pirate-get/pirate-get.sh or should it just be $HOME/.config/pirate-get with pirate-get being a file rather than a directory?

rnhmjoj commented 7 years ago

echo $XDG_CONFIG_HOME returns a blank string, so presumably this means it isn't set?

Exactly

Just to clarify, is this the correct path: $HOME/.config/pirate-get/pirate-get.sh or should it just be $HOME/.config/pirate-get with pirate-get being a file rather than a directory?

Ah, there it is: the configuration file is $HOME/.config/pirate-get not $HOME/.config/pirate-get/pirate-get.sh. $HOME/.config/pirate-get is not a directory but the file itself. I didn't understand what you meant with path earlier, sorry.

covertbert commented 7 years ago

Ahaa, that makes sense! Seems I was being a little dense as, if I'd actually followed your instructions to the T, I would have been fine.

Cheers for your help. Much appreciated!

rnhmjoj commented 7 years ago

No, problem.