Skip to content

Commit 426ee27

Browse files
committed
Making more portable
1 parent 6f30c06 commit 426ee27

4 files changed

Lines changed: 113 additions & 4 deletions

File tree

fbCollector/download_events.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
here="$( cd "$(dirname "$0")" >/dev/null 2>&1 ; pwd -P )"
44

55
dt=$1
6-
basedir=$(grep basedir $here/config.ini | awk -F= '{print $2}'|tr -d '\r' | sed 's|f:|/mnt/f|g')
6+
basedir=$(grep basedir $here/config.ini | awk -F= '{print $2}'|tr -d '\r' | sed 's|f:|/mnt/f|g' | sed 's|c:|/mnt/c|g')
77
echo $basedir
88
sleep 30
99
dtns=$dt

fbCollector/fbCollector.ps1

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,12 @@
44
#
55
push-location $PSScriptRoot
66

7-
. ..\helperfunctions.ps1
8-
$ini=get-inicontent ..\analysis.ini
7+
. .\helperfunctions.ps1
8+
$ini=get-inicontent .\config.ini
99

1010

1111
conda activate ukmon-shared
12-
$wmplloc=$ini['wmpl']['wmpl_loc']
12+
$wmplloc=$ini['fireballs']['wmpl_loc']
1313
$env:pythonpath="$wmplloc"
1414

1515
if ($args.count -lt 1) {

fbCollector/helperfunctions.ps1

Lines changed: 107 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,107 @@
1+
# helper functions
2+
3+
Function Get-IniContent {
4+
<#
5+
.Synopsis
6+
Gets the content of an INI file
7+
8+
.Description
9+
Gets the content of an INI file and returns it as a hashtable
10+
11+
.Notes
12+
Author : Oliver Lipkau <oliver@lipkau.net>
13+
Blog : http://oliver.lipkau.net/blog/
14+
Source : https://github.com/lipkau/PsIni
15+
http://gallery.technet.microsoft.com/scriptcenter/ea40c1ef-c856-434b-b8fb-ebd7a76e8d91
16+
Version : 1.0 - 2010/03/12 - Initial release
17+
1.1 - 2014/12/11 - Typo (Thx SLDR)
18+
Typo (Thx Dave Stiff)
19+
20+
#Requires -Version 2.0
21+
22+
.Inputs
23+
System.String
24+
25+
.Outputs
26+
System.Collections.Hashtable
27+
28+
.Parameter FilePath
29+
Specifies the path to the input file.
30+
31+
.Example
32+
$FileContent = Get-IniContent "C:\myinifile.ini"
33+
-----------
34+
Description
35+
Saves the content of the c:\myinifile.ini in a hashtable called $FileContent
36+
37+
.Example
38+
$inifilepath | $FileContent = Get-IniContent
39+
-----------
40+
Description
41+
Gets the content of the ini file passed through the pipe into a hashtable called $FileContent
42+
43+
.Example
44+
C:\PS>$FileContent = Get-IniContent "c:\settings.ini"
45+
C:\PS>$FileContent["Section"]["Key"]
46+
-----------
47+
Description
48+
Returns the key "Key" of the section "Section" from the C:\settings.ini file
49+
50+
.Link
51+
Out-IniFile
52+
#>
53+
54+
[CmdletBinding()]
55+
Param(
56+
[ValidateNotNullOrEmpty()]
57+
[ValidateScript({(Test-Path $_) -and ((Get-Item $_).Extension -eq ".ini")})]
58+
[Parameter(ValueFromPipeline=$True,Mandatory=$True)]
59+
[string]$FilePath
60+
)
61+
62+
Begin
63+
{Write-Verbose "$($MyInvocation.MyCommand.Name):: Function started"}
64+
65+
Process
66+
{
67+
Write-Verbose "$($MyInvocation.MyCommand.Name):: Processing file: $Filepath"
68+
69+
$ini = @{}
70+
switch -regex -file $FilePath
71+
{
72+
"^\[(.+)\]$" # Section
73+
{
74+
$section = $matches[1]
75+
$ini[$section] = @{}
76+
$CommentCount = 0
77+
}
78+
"^(;.*)$" # Comment
79+
{
80+
if (!($section))
81+
{
82+
$section = "No-Section"
83+
$ini[$section] = @{}
84+
}
85+
$value = $matches[1]
86+
$CommentCount = $CommentCount + 1
87+
$name = "Comment" + $CommentCount
88+
$ini[$section][$name] = $value
89+
}
90+
"(.+?)\s*=\s*(.*)" # Key
91+
{
92+
if (!($section))
93+
{
94+
$section = "No-Section"
95+
$ini[$section] = @{}
96+
}
97+
$name,$value = $matches[1..2]
98+
$ini[$section][$name] = $value
99+
}
100+
}
101+
Write-Verbose "$($MyInvocation.MyCommand.Name):: Finished Processing file: $FilePath"
102+
Return $ini
103+
}
104+
105+
End
106+
{Write-Verbose "$($MyInvocation.MyCommand.Name):: Function ended"}
107+
}

fbCollector/requirements.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,3 +4,5 @@ boto3
44
Pillow
55
paramiko
66
meteortools
7+
scp
8+
pyqtgraph

0 commit comments

Comments
 (0)