Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

sort images alphabetical #8

Open
angelheart150 opened this issue Dec 23, 2022 · 5 comments
Open

sort images alphabetical #8

angelheart150 opened this issue Dec 23, 2022 · 5 comments

Comments

@angelheart150
Copy link

Dear, gutosie

could you please make command lines to sort images alphabetical in main screen?
or can you sort alphabetical images in main screen?
thanks

Drogi, Gutosie

czy mógłbyś zrobić wiersze poleceń, aby sortować obrazy alfabetycznie na ekranie głównym?
czy możesz sortować obrazy alfabetycznie na ekranie głównym?
dzięki

@gutosie
Copy link
Owner

gutosie commented Dec 26, 2022 via email

@angelheart150
Copy link
Author

Dear, gutosie

Finally I did it .

**every thing is working smoothly ,
Now your plugin is exclusive plugin that can sort images.

I changed some code lines in plugin to sort images alphabetically**

the changes in 2 files :
plugin.py >> [ /usr/lib/enigma2/python/Plugins/Extensions/NeoBoot ]
neoreboot >> [ /usr/lib/enigma2/python/Plugins/Extensions/NeoBoot/files ]

In plugin.py :

`class NeoBootImageChoose(Screen):

... (existing code)

def updateList(self):

... (existing code)

    if mypath2 == 'Flash':
        image = getImageDistroN()
        writefile = open('%sImageBoot/.Flash' % getNeoLocation(), 'w')
        writefile.write(image)
        writefile.close()
        image = ' [' + image + ']'
        self.list.append('Flash' + image)

    elif fileExists('%sImageBoot/.Flash' % getNeoLocation()):
        f = open('%sImageBoot/.Flash', 'r' % getNeoLocation())
        image = f.readline().strip()
        f.close()

    image = ' [' + image + ']'
    self.list.append('Flash' + image)
    self['label5'].setText(mypath)

    if fileExists('/.multinfo'):
        f2 = open('/.multinfo', 'r')
        mypath3 = f2.readline().strip()
        f2.close()
        self['label6'].setText(mypath3)
    else:
        f2 = open('%sImageBoot/.neonextboot' % getNeoLocation(), 'r')
        mypath3 = f2.readline().strip()
        f2.close()
        self['label6'].setText(mypath3)

    # Retrieve the list of images and ignore the "Flash" image
    mypath = ('%sImageBoot' % getNeoLocation())
    myimages = listdir(mypath)
    self.list = [fil for fil in myimages if os.path.isdir(os.path.join(mypath, fil)) and fil != 'Flash']  # Ignore the "Flash" image

    # Sort the list before setting it to config (case-insensitive)
    self.list = sorted(self.list, key=lambda x: x.lower())
 # Add the "Flash [My image = egami 10.5R7]" image to the list
    if fileExists('%sImageBoot/.Flash' % getNeoLocation()):
        f = open('%sImageBoot/.Flash' % getNeoLocation(), 'r')
        image = f.readline().strip()
        f.close()
        image = ' [' + image + ']'
        self.list.insert(0, 'Flash' + image)  # Insert the "Flash" image at the beginning of the list

    self['config'].setList(self.list)

    self['label7'].setText(str(len(self.list) - 1))
    self['config'].setList(self.list)

    strview = PLUGINVERSION
    self['label9'].setText(strview)

    KERNELVERSION = getKernelImageVersion()
    strview = KERNELVERSION
    self['label20'].setText(strview)

    self['label17'].setText(readline('/etc/hostname'))
    self['label19'].setText(readline('%sImagesUpload/.kernel/used_flash_kernel' % getNeoLocation()))

    strview = UPDATEVERSION
    self['label10'].setText(strview)

... (remaining code)`

تعديل البلجن الاساسي 1

تعديل البلجن الاساسي 2
Results :

1_0_1_8AA_16_800_DCA0000_0_0_0_20240726235340

1_0_1_8AA_16_800_DCA0000_0_0_0_20240726235353

1_0_1_8AA_16_800_DCA0000_0_0_0_20240726235357

1_0_1_8AA_16_800_DCA0000_0_0_0_20240726235403

In neoreboot :

`def updateInfo(self):
self.list = []
pluginpath = '' + LinkNeoBoot + ''
f = open(pluginpath + '/.location', 'r')
mypath = f.readline().strip()
f.close()

    curimage = 'Flash'
    if fileExists('/.multinfo'):
        f = open('/.multinfo', 'r')
        curimage = f.readline().strip()
        f.close()
    strview = _('Current Running Image: ') + curimage
    self.curimage = curimage
    self['lab1'].setText(strview)
    
    linesdevice = open('' + LinkNeoBoot + '/.location', 'r').readlines()
    deviceneo = linesdevice[0][0:-1]
    device = deviceneo
    devicelist = ['cf',
     'hdd',
     'card',
     'usb',                            
     'usb2']
    for d in listdir('' + getNeoLocation() +''):
        if d == 'ImageBoot':
            continue
        test = '' + getNeoLocation() +'' + d + '/.neonextboot'
        if fileExists(test):
            device = d
            
    strview = _('NeoBoot Installed on: ') + device
    self['lab2'].setText(strview)
    
    imageslist = ['Flash']
    for fn in sorted(listdir('' + getNeoLocation() + '/ImageBoot'), key=lambda x: x.lower()):
        dirfile = '' + getNeoLocation() + '/ImageBoot/' + fn
        if os_isdir(dirfile):
            imageslist.append(fn)
            
    self['list'].list = imageslist

... (remaining code)`

neoreboot py

Results :

1_0_1_70D_12_800_DCA0000_0_0_0_20240727022500

and for repairing NeoReboot.py in all images :

I made this bash script :

#!/bin/bash for folder in /media/hdd/ImageBoot/*/usr/lib/enigma2/python/Plugins/Extensions/NeoReboot; do for file in "$folder"/plugin.*; do if [ -f "$file" ]; then rm -f "$file" fi done cp -af '/usr/lib/enigma2/python/Plugins/Extensions/NeoBoot/files/neoreboot' "$folder/plugin.py" done exit 0
you can merge it in next version

Thank you so much for your great plugin .

Mohamed Elsafty
one of neoboot adores

@gutosie
Copy link
Owner

gutosie commented Jul 27, 2024 via email

@angelheart150
Copy link
Author

you are welcome dear
thanks for the moment make me help you as you help all enigma2 people .
the two files attached
you can make more . you are genius .
NeoBoot.zip

@angelheart150
Copy link
Author

angelheart150 commented Oct 26, 2024

dear gutosie

this my modification to sort images in tools

tools.zip

1_0_19_1F8_EAC4_77E_DCA0000_0_0_0_20241026094409

1_0_19_1F8_EAC4_77E_DCA0000_0_0_0_20241026094419

1_0_19_1F8_EAC4_77E_DCA0000_0_0_0_20241026094426

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants