adriengibrat / torrent-rw

php5 class to read and write .torrent files
GNU General Public License v3.0
324 stars 104 forks source link

Merge Changes/demo #55

Closed darkalchemy closed 4 years ago

darkalchemy commented 4 years ago

Incorporates changes requested by @xxalfa in PR #50 and by @Machou in PR #54 along with adding install by composer.

AlphaOne89 commented 4 years ago

I have to point out again, files in hidden folders should be hidden.

Given directory structure

test_dir\.hidden\.hidden.txt
test_dir\.hidden\aaa.txt
test_dir\ccc\.hidden.txt
test_dir\ccc\ccc.txt
test_dir\ddd.txt
test_dir\eee.txt

Your result

test_dir\.hidden\aaa.txt
test_dir\ccc\ccc.txt
test_dir\ddd.txt
test_dir\eee.txt

Expected result

test_dir\ccc\ccc.txt
test_dir\ddd.txt
test_dir\eee.txt
darkalchemy commented 4 years ago

How did you call it? If you want to ignore hidden files, the last param should be false, call it like so:

$torrent = new Torrent(/path/to/torrent/file, [], 256, false)

edit: I didn't see that that you wanted to ignore hidden folders, I will look into it.

AlphaOne89 commented 4 years ago

In my branch I called the variable $skip_hidden_objects. I took it for granted that both types should be hidden.

darkalchemy commented 4 years ago

It's fixed now. I don't know how to write unit tests, so I have included it bin/demo.php. When run within the git repo, it will create a torrent of that folder, ignoring all hidden files and folders.

AlphaOne89 commented 4 years ago

I am pleased that someone is bothering and continues to work, but I am not really enthusiastic about your changes and I would not like it if the changes were adopted in the main branch. An example, the following line $br = PHP_SAPI === 'cli' ? PHP_EOL : "\n"; of code makes no sense, it should look like this $br = PHP_SAPI === 'cli' ? PHP_EOL : "<br>";. I have already completely revised my branch, only details should be taken from it, such as the inclusion of an iterator. Your changes are a bit too extensive.

darkalchemy commented 4 years ago

You're quoting from a demo file that has no bearing on the class itself and it's so its readable from cli and a webpage, since the original demo was written to view from a webpage.

AlphaOne89 commented 4 years ago

It is not necessary to explain the code by specifying "<br>" an HTML tag, as I have already made it clear that it is intended to be displayed on a web page. Unfortunately, you don't understand what I'm saying.

darkalchemy commented 4 years ago

Since it appears that only you and I are going to comment on this. I propose you step up and take over maintenance of this project and I will step away and continue to use my own fork.