Creating a download profile and load default method, Improving install default.

This commit is contained in:
ruidajo 2024-09-15 18:51:49 -05:00
parent 2f7d3a5cc0
commit 09df2285f7

View File

@ -1,9 +1,27 @@
Class {
#name : #InstagramDownloader,
#superclass : #Object,
#instVars : [
'bin',
'profiles'
],
#category : #Instagram
}
{ #category : #'as yet unclassified' }
InstagramDownloader >> downloadProfile: anInstProfileName [
| profiles |
profiles := (FileLocator documents / 'InstagramDownloader' / 'Profiles') ensureCreateDirectory.
^ GtSubprocessWithInMemoryOutput new
workingDirectory: profiles;
command: bin fullName;
arguments: {anInstProfileName.
'--no-videos'.
'--no-compress-json'};
runAndWait;
stdout
]
{ #category : #'as yet unclassified' }
InstagramDownloader >> initialize [
super initialize.
@ -11,7 +29,28 @@ InstagramDownloader >> initialize [
{ #category : #'as yet unclassified' }
InstagramDownloader >> installDefault [
| py |
| py doc location |
doc := FileLocator documents.
location := (doc / 'InstagramDownloader') ensureCreateDirectory.
py := PyEnv new.
py createEnv: 'InstagramDownloader' in: FileLocator documents
py createEnv: 'InstagramDownloader' in: doc.
py install: 'instaloader' in: 'InstagramDownloader'.
bin := location / 'bin' / 'instaloader'.
]
{ #category : #accessing }
InstagramDownloader >> loadDefault [
| temp |
temp := FileLocator documents / 'InstagramDownloader'.
bin := temp / 'bin' / 'instaloader'.
profiles := temp / 'Profiles'
]
{ #category : #'as yet unclassified' }
InstagramDownloader >> profiles [
| location |
profiles
ifNil: [ location := bin parent parent / 'Profiles'.
location exists ifFalse: [ ^ profiles := location ensureCreateDirectory ] ].
^ profiles
]